Linux 允许root用户远程登陆
2024-09-05 09:29:30
首先确保ssh服务已经安装:
ps -e | grep ssh
or
service ssh start
如果没有安装则:
apt-get install ssh
安装完之后
查看 /etc/ssh/sshd_config
cat sshd_config
# $OpenBSD: sshd_config,v 1.102 // :: djm Exp $ # This is the sshd server system-wide configuration file. See
# sshd_config() for more information. # This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin # The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
# default value. #Port
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress :: #HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key # Ciphers and keying
#RekeyLimit default none # Logging
#SyslogFacility AUTH
#LogLevel INFO # Authentication: #LoginGraceTime 2m
#PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries
#MaxSessions #PubkeyAuthentication yes # Expect .ssh/authorized_keys2 to be disregarded by default in future.
#AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2 #AuthorizedPrincipalsFile none #AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes # To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no # Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no # Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no # GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no # Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes #AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset
#X11UseLocalhost yes
#PermitTTY yes
PrintMotd no
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval
#ClientAliveCountMax
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups ::
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none # no default banner path
#Banner none # Allow client to pass locale environment variables
AcceptEnv LANG LC_* # override default of no subsystems
Subsystem sftp /usr/lib/openssh/sftp-server # Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# PermitTTY no
# ForceCommand cvs server
目前被注释,且默认为禁止状态 #PermitRootLogin prohibit-password
修改:
PermitRootLogin yes
然后重启SSH服务:
service sshd restart
OR
/etc/initd.d/sshd restart
重新连接就可以了
最新文章
- c#线程带参数
- 基于HT for Web矢量实现2D叶轮旋转
- 页面内容排序插件jSort的使用
- 【第41套测试题NOIP2007】【排序】【DP】【高精度】【树】【图上路径】
- JSON-JQuery常用技巧
- OpenERP新手易犯错误之res.model
- Django Web开发【1】Django简介
- 【Linux&;amp;Unix--文件描述叙事的性格和权柄】
- 无法创建链接服务器 ";xxx"; 的 OLE DB 访问接口 ";OraOLEDB.Oracle"; 的实例。 (Microsoft SQL Server,错误: 7302)
- Linux中nmon的安装与使用【转】
- 201521123013 《Java程序设计》第6周学习总结
- javascript 三种弹出对话框
- python_代码中调用java类
- cestOs 7安装Jenkins
- 空类指针为什么可以调用类的成员函数 以及 A(){}和A();
- hdu2060-2062
- Linux file命令详解
- echarts中datazoom相关配置
- spring MVC 后台token防重复提交解决方案
- Java并发编程(六):Java里实现对象安全发布的四种方式