ubuntu16.04 ssh服务 静态ip配置

1,770 阅读1分钟

ctr + alt + t 打开命令行

先更新下

sudo apt update

ubuntu 16.04下静态IP地址的设置

一、编辑interfaces

sudo vi  /etc/network/interfaces 

内容如下

auto lo
iface lo inet loopback
#添加以下内容
auto ens33
iface ens33 inet static
address 172.16.10.194
netmask 255.255.255.0
gateway 172.16.10.1
dns-nameserver 8.8.8.8

二、重启网络

sudo ip addr flush ens33 
sudo systemctl restart networking 
sudo /etc/init.d/networking restart 

设置/修改用户密码

设置root密码

sudo passwd root
sudo passwd liviuscn 

切换到root

su root

切换到liviuscn用户

su liviuscn 

安装 ssh

sudo apt-get install openssh-server

修改端口

sudo vi /etc/ssh/sshd_config

是否启动

ps -e | grep ssh

重启

sudo /etc/init.d/ssh resart

windows下载安装putty

通过ip连接

linux一些命令

mv a b 
rm a
rm -rf doc
:q! 退出不保存
shift+zz 退出保存
sudo chmod 777 ××× (每个人都有读和写以及执行的权限)