ubuntu 开启远程连接 ssh

Source :http://ubuntuhandbook.org/index.php/2014/09/enable-ssh-in-ubuntu-14-10-server-desktop/

Secure Shell (SSH) is a protocol for securely accessing remote machine, it allows you to run command line and graphical programs, transfer files, and even create secure virtual private networks over the Internet.

Ubuntu does not provide the ssh service out-of-the-box. But you can easily enable it by installing the OpenSSH server package.

To enable SSH:

Search for and install the openssh-server package from Ubuntu Software Center. Or run command below in console if you’re on Ubuntu Server without GUI:

sudo apt-get install openssh-server

Once installed, the SSH service should be started automatically. If necessary, you can start (or stop, restart) the service manually via command:

sudo service ssh start

To edit settings:

To change the port, root login permission, you may edit the/etc/ssh/sshd_config file via:

sudo nano /etc/ssh/sshd_config

After you changed the configurations, press Ctrl+X followed by typing y and hitting enter to save the file.

Finally restart the SSH service to apply the changes:

sudo service ssh restart

Usage and Tips:

1. Normally, we can access remote machine through SSH via command:

ssh username@remote-ip

For the port that is not the default 22:

ssh username@remote-ip -p NUMBER

2. For desktop Ubuntu, root user need to be enabled first so that remote machines can SSH to it via root:

Run command below to set a password for root:

sudo passwd root

Then execute command to unlock the root account:

sudo passwd -u root

Edit the config file /etc/ssh/sshd_config, change the line

PermitRootLogin without-password

into:

PermitRootLogin yes

When done, restart the SSH service.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值