ssh远程连接Ubuntu



SSH服务器,可以通过SSH协议来访问远程服务器,代替telnet和ftp。但是ubuntu默认是不启用root用户,也不允许root远程登录的。所以需要先启用root用户
 
启用root用户:sudo passwd root      //修改密码后就启用了。
 
安装OpenSSH server:
1. 使用apt命令安装openssh server
$ sudo apt-get install openssh-server
 
 
2. 可以对 openssh server进行配置
$ sudo vi /etc/ssh/sshd_config
找到PermitRootLogin no一行,改为PermitRootLogin yes
 
3. 重启 openssh server
$ sudo service ssh restart
 
4. 客户端如果是ubuntu的话,则已经安装好ssh client,可以用下面的命令连接远程服务器。
$ ssh xxx.xxx.xxx.xxx

如果是windows系统的话,可以使用SSH Secure Shell等ssh软件进行远程连接。


如果出现这个问题:

ssh: connect to host localhost port 22: Connection refused

需要重启ssh

然后检查一下是不是重新运行了:

ps aux | grep -i ssh


或者先卸载掉

$ sudo apt-get remove openssh-server

再重新安装一遍


Fire this command:

sudo iptables -L

and what do you see? If you are seeing that no traffic is allowed. In that case if that's true, then

sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT

this command tells system to allow incoming connection to port 22...and usually should solve your dilemma, specifically for ssh / sshd



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值