ubuntu20.04安装ssh连接xshell

开启 SSH 可远程管理,使用 putty、iTerm 或者系统自带的 shell 工具进行操作。

# ssh 开启
# 默认只安装ssh-client服务
dpkg -l | grep ssh

# 安装ssh-server服务
sudo apt-get install openssh-server
dpkg -l | grep ssh
# 然后确认ssh-server是否启动了
ps -e | grep ssh
# 启动 ssh
sudo /etc/init.d/ssh start
#  也可以用以下命令启动
sudo service ssh start

ssh相关配置

#  配置相关: 支持远程访问
sudo nano /etc/ssh/sshd_config
# 在这里可以定义SSH的服务端口,默认端口是22,你可以自己定义成其他端口号,如222
# 把配置文件中的”PermitRootLogin without-password”加一个”#”号,把它注释掉
# 把配置文件中的”PermitRootLogin prohibit-password”加一个”#”号,把它注释掉
# 增加一句
PermitRootLogin yes
# 然后重启SSH服务:
sudo /etc/init.d/ssh restart
sudo service ssh restart
# nano
完成后按ctrl+x退出,按y保存

------------------基本就ok了,可以连接成功xshell

网络配置:

# 查看网络信息
ip addr
ifconfig
# 修改 IP 最后 ens32 为网卡名称
nano /etc/sysconfig/network-scripts/ifcfg-ens32
# or
nano /etc/network/interfaces
# 修改以下
bootproto=static
onboot=yes
# 在最后加上几行,IP地址、子网掩码、网关、dns服务器
IPADDR=192.168.1.160
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=114.114.114.114
DNS2=8.8.8.8
# 重启网络服务
systemctl restart network
service network-manager restart
/etc/init.d/networking restart

SSH 使用:

# 在终端输入,对应域名
ssh [email protected]
# 连接成功后输入密码即可登录成功

 参考地址:https://www.gairuo.com/p/ubuntu-django-nginx

猜你喜欢

转载自blog.csdn.net/chehec2010/article/details/115135409