VMWare安装的ubuntu19.04设置22端口远程连接

个人博客:小景哥哥

VMWare安装的ubuntu19.04设置22端口远程连接

一、安装openssh-server

sudo su
apt install openssh-server

二、查看ssh服务

jason@ubuntu:~/Desktop$ ps -e | grep ssh
   720 ?        00:00:00 sshd
  1638 ?        00:00:00 ssh-agent
  1715 ?        00:00:00 sshd
jason@ubuntu:~/Desktop$ service sshd status
   ssh.service - OpenBSD Secure Shell server
   Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enab
   `Active: active (running)`since Thu 2019-10-03 00:47:55 PDT; 2min 36s ago
     Docs: man:sshd(8)
           man:sshd_config(5)
  Process: 711 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
 Main PID: 720 (sshd)
    Tasks: 1 (limit: 2302)
   Memory: 4.6M
   CGroup: /system.slice/ssh.service
           └─720 /usr/sbin/sshd -D

Oct 03 00:47:54 ubuntu systemd[1]: Starting OpenBSD Secure Shell server...
Oct 03 00:47:55 ubuntu sshd[720]: Server listening on 0.0.0.0 port 22.
Oct 03 00:47:55 ubuntu sshd[720]: Server listening on :: port 22.
Oct 03 00:47:55 ubuntu systemd[1]: Started OpenBSD Secure Shell server.
Oct 03 00:48:24 ubuntu sshd[1715]: Accepted password for root from 172.16.170.1 
Oct 03 00:48:24 ubuntu sshd[1715]: pam_unix(sshd:session): session opened for us
lines 1-18/18 (END)

三、设置root远程登录

sudo vim /etc/ssh/sshd_config

将PermitRootLogin 设置为 yes

PermitRootLogin yes

若需要可以设置root密码

sudo passwd root

重启ssh即可

sudo service ssh restart

四、远程连接测试

ssh [email protected]
发布了263 篇原创文章 · 获赞 304 · 访问量 11万+

猜你喜欢

转载自blog.csdn.net/JingLisen/article/details/101999674