当前位置: 首页>>技术教程>>正文


在Ubuntu 16.04 Xenial Xerus Linux Server/Desktop上启用SSH根登录

, ,
以下配置将指导您完成在Ubuntu 16.04 Xenial Xerus Linux Server或Desktop上启用SSH根登录的过程。本指南假定您拥有root密码,并且能够以root用户身份直接在系统上登录。如果您没有以下内容,请使用以下指南root用户密码

默认情况下,默认情况下拒绝根的ssh远程Shell访问。以root身份远程登录的任何尝试都会导致Permission denied信息:


$ ssh This email address is being protected from spambots. You need JavaScript enabled to view it.
				document.getElementById('cloakf28e6438eed014441a0877920cab51ea').innerHTML = '';
				var prefix = 'ma' + 'il' + 'to';
				var path = 'hr' + 'ef' + '=';
				var addyf28e6438eed014441a0877920cab51ea = 'root' + '@';
				addyf28e6438eed014441a0877920cab51ea = addyf28e6438eed014441a0877920cab51ea + '10' + '.' + '0' + '.' + '0' + '.' + '55';
				var addy_textf28e6438eed014441a0877920cab51ea = 'root' + '@' + '10' + '.' + '0' + '.' + '0' + '.' + '55';document.getElementById('cloakf28e6438eed014441a0877920cab51ea').innerHTML += ''+addy_textf28e6438eed014441a0877920cab51ea+'';
		
This email address is being protected from spambots. You need JavaScript enabled to view it.
				document.getElementById('cloakcbfca924b17e5bbf8fd22dc862fa95bc').innerHTML = '';
				var prefix = 'ma' + 'il' + 'to';
				var path = 'hr' + 'ef' + '=';
				var addycbfca924b17e5bbf8fd22dc862fa95bc = 'root' + '@';
				addycbfca924b17e5bbf8fd22dc862fa95bc = addycbfca924b17e5bbf8fd22dc862fa95bc + '10' + '.' + '0' + '.' + '0' + '.' + '55';
				var addy_textcbfca924b17e5bbf8fd22dc862fa95bc = 'root' + '@' + '10' + '.' + '0' + '.' + '0' + '.' + '55';document.getElementById('cloakcbfca924b17e5bbf8fd22dc862fa95bc').innerHTML += ''+addy_textcbfca924b17e5bbf8fd22dc862fa95bc+'';
		's password: 
Permission denied, please try again.
This email address is being protected from spambots. You need JavaScript enabled to view it.
				document.getElementById('cloak8bcb2c64b8983f6524f0f026d9136d08').innerHTML = '';
				var prefix = 'ma' + 'il' + 'to';
				var path = 'hr' + 'ef' + '=';
				var addy8bcb2c64b8983f6524f0f026d9136d08 = 'root' + '@';
				addy8bcb2c64b8983f6524f0f026d9136d08 = addy8bcb2c64b8983f6524f0f026d9136d08 + '10' + '.' + '0' + '.' + '0' + '.' + '55';
				var addy_text8bcb2c64b8983f6524f0f026d9136d08 = 'root' + '@' + '10' + '.' + '0' + '.' + '0' + '.' + '55';document.getElementById('cloak8bcb2c64b8983f6524f0f026d9136d08').innerHTML += ''+addy_text8bcb2c64b8983f6524f0f026d9136d08+'';
		's password:

为了在Ubuntu 16.04 Xenial Xerus Linux上启用root ssh登录,请运行以下命令linux命令


$ sudo sed -i 's/prohibit-password/yes/' /etc/ssh/sshd_config

或手动打开sshd配置文件/etc/ssh/sshd_config并更改行:


FROM:
PermitRootLogin prohibit-password
TO:
PermitRootLogin yes

完成上述配置更改后,请重新启动ssh守护程序:




(adsbygoogle = window.adsbygoogle || [])。push({});



$ sudo systemctl restart sshd

重新启动sshd守护程序后,您将能够以root用户身份远程登录:


$ ssh This email address is being protected from spambots. You need JavaScript enabled to view it.
				document.getElementById('cloak34e2e6f2cfea58bb53bebb49d0131dd0').innerHTML = '';
				var prefix = 'ma' + 'il' + 'to';
				var path = 'hr' + 'ef' + '=';
				var addy34e2e6f2cfea58bb53bebb49d0131dd0 = 'root' + '@';
				addy34e2e6f2cfea58bb53bebb49d0131dd0 = addy34e2e6f2cfea58bb53bebb49d0131dd0 + '10' + '.' + '0' + '.' + '0' + '.' + '55';
				var addy_text34e2e6f2cfea58bb53bebb49d0131dd0 = 'root' + '@' + '10' + '.' + '0' + '.' + '0' + '.' + '55';document.getElementById('cloak34e2e6f2cfea58bb53bebb49d0131dd0').innerHTML += ''+addy_text34e2e6f2cfea58bb53bebb49d0131dd0+'';
		
This email address is being protected from spambots. You need JavaScript enabled to view it.
				document.getElementById('cloak5f75d7445fcaa6d807142a68c957316a').innerHTML = '';
				var prefix = 'ma' + 'il' + 'to';
				var path = 'hr' + 'ef' + '=';
				var addy5f75d7445fcaa6d807142a68c957316a = 'root' + '@';
				addy5f75d7445fcaa6d807142a68c957316a = addy5f75d7445fcaa6d807142a68c957316a + '10' + '.' + '0' + '.' + '0' + '.' + '55';
				var addy_text5f75d7445fcaa6d807142a68c957316a = 'root' + '@' + '10' + '.' + '0' + '.' + '0' + '.' + '55';document.getElementById('cloak5f75d7445fcaa6d807142a68c957316a').innerHTML += ''+addy_text5f75d7445fcaa6d807142a68c957316a+'';
		's password: 
Welcome to Ubuntu 16.04 LTS (GNU/Linux 4.4.0-22-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

22 packages can be updated.
20 updates are security updates.


The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/11106.html,未经允许,请勿转载。