LiveCD 开启SSH服务
1.设置IP地址
- # ip addr add 192.168.219.130/24 dev eth0
- # ip a
2.为root设置密码
- # passwd root
3.开启ssh服务
- # find / -name 'sshd'
- # /usr/sbin/sshd -f /etc/ssh/sshd_config
- ERROR "Missing privilege separation directory: /var/lib/sshd"
- # mkdir -pv /var/lib/sshd
- # /usr/sbin/sshd -f /etc/ssh/sshd_config
- # ps aux |grep [s]shd
4.通过Xmanager连接,出现如下错误
- "WARNING! The remote SSH server rejected X11 forwarding request."
5.经查日志,获取如下错误信息
- error: openpty: No such file or directory
- error: session_pty_req: session 0 alloc failed
6.查看/dev/ptmx和/dev/pts是否存在,以及ptmx的权限是否正确
- #ls -l `find /dev/ -name 'ptmx'`
- crw-rw-rw- 1 root tty 5, 2 5月 5 14:46 /dev/ptmx
- #find /dev/ -name 'pts'
7.查看/etc/fstab
- # cat /etc/fstab
- none /proc proc defaults 0 0
- sysfs /sys sysfs defaults 0 0
- devpts /dev/pts devpts gid=4,mode=620 0 0
- tmpfs /dev/shm tmpfs defaults 0 0
8.mount /dev/pts
- 连接ssh成功,执行umount -l /dev/pts后
- "WARNING! The remote SSH server rejected X11 forwarding request."
- 错误重现,无法通过ssh连接服务器,错误日志如下
- error: openpty: No such file or directory
- error: session_pty_req: session 0 alloc failed