Windows create Linux root rights account SSH key Putty login prohibit root account __linux

Source: Internet
Author: User
background:

Not familiar with Linux, the new server centos,1 a gpu,512m memory, would like to use to put something;
Dos attack, and then understand the need for SSH key login, but also prohibit the account password log in the way, prohibit the use of root account login tool

Putty: Very small, find a corresponding download on the line, click on the download address, mainly in the full version has a puttyagent, used to convert the key format, generate the key these. Baidu comes out is a separate putty, function single convenient login.
WINSCP: Search How to download files from a Linux server and find this. Also OK, this is under the Baidu, appear that on the ordinary download it. Putty Login Key Login SSH in session, hostname, fill in the IP address, port 22; then find auth in ssh below connection, click Browse to add local private key and then open it again Create root account log in first root account, then create account, modify password

AddUser name
passwd name
Add root permission, there are many ways, I use the Modify file, add user rights. More in the reference article at the end of the article.
The following space, is the TAB key, after adding, encountered insufficient permissions, with sudo command, such as sudo ls
Vi/etc/sudoers
# # Allow ROOT to run any commands anywhere
root  all=
name  all= (All) All   
To switch users, use:
SU User name
More detailed reference: [1] Add SSH keyRead a lot of articles, feel the main idea is to generate a pair of public, private key, and then one on the local, one on the server. The authorized_keys inside the SSH folder is created using Putty to create the key, and then upload or copy to the server. can refer to: Linux under Prohibit users to use the password way login reference [2] set SSH through key login:
[Root@host ~]$ Ssh-keygen  <== establishes the key pair
generating public/private RSA key pair.
Enter file in which to save the key (/ROOT/.SSH/ID_RSA): <== Press Enter
Created directory '/root/.ssh '.
Enter passphrase (empty for no passphrase): <== Enter the key lock code, or press ENTER to leave blank
enter same passphrase again: <== Enter the key lock code again C7/>your identification has been saved In/root/.ssh/id_rsa. <== private key
Your public key has been saved in/root/.ssh/id_rsa.pub. <== the key
fingerprint:
0f:d3:e7 : 1a:1c:bd:5c:03:f1:19:f1:22:df:9b:cc:08 root@host

And there is. SSH is a hidden directory, using ls-a to view

[Root@host ~]$ cd. SSH
[root@host. ssh]$ cat id_rsa.pub >> authorized_keys

[root@host. ssh]$ chmod Horized_keys
[root@host. ssh]$ chmod ~/.ssh

The public key on the server is configured, then you can open Id_rsa, then copy, build a Id_ras file on the local computer, paste it in
Then use puttyagent,load this file, save as the Putty recognized private key;
You can also use WINSCP, connect to the server, download the file, remember the file address: The newly created user is in the/home/user/.ssh/, the key file created by the root user in/root/.ssh/, note. ssh files are hidden folders The root account is forbidden to note that the settings must be passed after the other account, only to ban root, or it is over. File length, you can press ESC, then press Slash/, and then enter find content
Edit settings file:

Vi/etc/ssh/sshd_config

Modify use Key:

Pubkeyauthentication Yes

Prohibit account password way to log in

Passwordauthentication No

Prohibit root account, must use other user test through, can link, can sudo permission, can use SU root, switch to root user

Permitrootlogin No

Restart sshd

[Root@host. ssh]$ Service sshd Restart
not familiar with Linux, reference articles are:

[1] Create root rights account, reference article: Http://www.jb51.net/article/97513.htm
[2] Create SSH key, reference article: http://www.runoob.com/w3cnote/ Set-ssh-login-key.html
[3] Add SSH key login to newly created account reference article: http://blog.sina.com.cn/s/blog_613480a50102w6cm.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.