Ubuntu下SSH安装或设置

来源:互联网 发布:华为云计算平台 编辑:程序博客网 时间:2024/06/05 23:45

ubuntu默认并没有安装ssh服务,如果通过ssh链接ubuntu,需要自己手动安装ssh-server,然而SSH分客户端openssh-client和服务端openssh-server,openssh-client是客户端,openssh-server是服务端
 
1.判断咱们的机器是否安装ssh服务,可以使用如下命令:
ssh localhost
ssh: connect to host localhost port 22: Connection refused
表示没有还没有安装SSH,
安装命令:sudo apt-get install openssh-server
卸载命令:sudo apt-get remove openssh-server
咱们运行 sudo apt-get install openssh-server 

2.ps -e|grep ssh  
1418 ?        00:00:00 sshd 
 看到sshd那说明ssh-server已经启动了

3.启动SSH:sudo /etc/init.d/ssh start 或者 service ssh start

4.SSH配置
gedit /etc/ssh/sshd_config
找到PermitRootLogin prohibit-password,加上#注释
在后边加上一句:PermitRootLogin  yes,然后保存

5.重新启动SSH:sudo/etc/init.d/ssh start 
6.查看当前的ip:
ifconfig

备注:
原先分配的IP:10.0.2.15
需在VirtualBox上:设置-网络-网卡1
修改连接方式:桥接网卡,然后确定
修改后的IP:192.168.1.***,这个IP是下一篇文章连接Linux远程的IP地址


原创粉丝点击