banner
ximalaya

ximalaya

这里是openkava 的blog,关注程序开发的一切技术。 ZZ 表示转载的文章,如涉及版权,请和我联系删除。 在这里你可以看到关于以下技术的文章: 移动开发技术,ANDROID ,IOS,WINDOWS PHONE平台开发,企业ERP开发,动态脚本PYTHON ,OPENGL ES 3D技术,游戏开发技术,HTML5 ,JAVASCRIPT ,MYSQL,AMAZON EC2 ,GOOGLE GAE ,GOOGLE CLOUD SQL 等 。 本站发展历程: 2010年,正式把所有的blog移到这里,租用godaddy的空间,记录生活和工作上的一些心得。 下面是关于我的个人介绍,写在这里权当凑字数啦。 职业:软件开发,开发经验6年,管理经验3年; 工作上使用的技术:C#, SQL SERVER 个人使用的技术:PYTHON,PHP, CSS, JAVA ,ANDROID ,object-c 等等 联系我请发邮件:<a href="http://blog.openkava.com/openkava@gmail.png"><img class="alignnone size-full wp-image-96" title="邮箱" src="http://blog.openkava.com/openkava@gmail.png" alt="" width="174" height="24" /></a>

linux ssh centos 6.2 login displays Server refused our key_回眸一度_ Baidu Space

linux ssh centos 6.2 login shows Server refused our key_回眸一度_百度空间.

Today, when setting up SSH key automatic login, I found that the message "Server refused our key" always appeared. After searching online for a long time, I found that the problem was with the permissions. Modifying the chmod permissions didn't work either. Finally, I found a method: restorecon -R -v /root/.ssh. After setting the permissions this way, I was able to log in.

restorecon, used to restore the default attributes of files/directories:

restorecon -v file # v is for 'verbose'restorecon -R dir # R is for 'recursive'
Set up SSH using key login:
1 Set /etc/ssh/sshd_config
PermitRootLogin yes

RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys

PasswordAuthentication no PermitEmptyPasswords no

2 service sshd restart

or

/etc/init.d/sshd restart

3 Set permissions:

chmod 600 /root/.ssh/authorized_keys

Add user to the su group:

Use the ordinary user "uploader" for remote management, then switch to the root user with "su root" to obtain the highest privileges

Modify ordinary user to have root privileges

1) Enter super user mode. That is, enter "su -", the system will ask for the super user password, enter the password and enter super user mode. (Of course, you can also use root directly)

2) Add write permission to the file. That is, enter the command "chmod u+w /etc/sudoers".

3) Edit the /etc/sudoers file. That is, enter the command "vim /etc/sudoers", enter "i" to enter edit mode, find this line: "root ALL=(ALL) ALL", add "xxx ALL=(ALL) ALL" below it (where xxx is your username), then save (press Esc key, then enter ":wq" to exit).

4) Revoke write permission for the file. That is, enter the command "chmod u-w /etc/sudoers".

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.