博文

目前显示的是标签为“root”的博文

Debian切换Root用户SSH远程登录及设置主机名

图片
  Debian切换Root用户SSH远程登录 Debian默认是不允许root用户登录,更不允许SSH登录,修改方法如下: 打开终端,用普通用户登录 在终端输入: su - 然后输入密码,切换到root用户 [ root@Debian ~]# su - Password : # 此处输入您的密码 [ root@Debian ~]# 设置root用户登录 修改sshd配置文件 [ root@Debian ~]# vi / etc / ssh / sshd_config 修改配置 查找PermitRootLogin,在"#PermitRootLogin prohibit-password"下面添加"PermitRootLogin yes",同时,查找"PasswordAuthentication",把"PasswordAuthentication yes"前面的注释“#”删除。 [ root@Debian ~]# vi / etc / ssh / sshd_config #PermitRootLogin prohibit-password PermitRootLogin yes ………… PasswordAuthentication yes 重启SSH服务 命令行输入以下任意一条命令即可 [ root@Debian ~]# / etc / init . d / ssh restart [ root@Debian ~]# systemctl restart sshd [ root@Debian ~]# service sshd restart Debian设置主机名 查看当前主机名 要查看当前主机名,请运行hostnamectl命令。在此示例中,当前主机名设置为localhost.localdomain。 [ root@Debian ~]# hostnamectl Static hostname : Debian Icon name : computer - vm Chassis : vm Machine ID : 032aab5f4da64fd789b0c302645ce586 ...