Ubuntu SSH: How To Enable Secure Shell in Ubuntu --转载

 

Hi! If you're new here, you may want to subscribe to the Unix Tutorial RSS feed to get regular tips & tricks for all flavors of Unix. You can follow me on Twitter, too! Thanks for visiting!

SSH (Secure SHell) is possibly the best way to remotely access a Unix system – it's very secure thanks to automatic encryption of all the traffic, and it's also quite universal because you can do all sorts of things: access remote command line shell, forward graphics session output, establish network tunnels and set up port redirections. Today I'm going to show you how to get started with SSH in Ubuntu.

Installing SSH server in Ubuntu

By default, your system will have no SSH service enabled, which means you won't be able to connect to it remotely using SSH protocol (TCP port 22). This means that installing SSH server will be one of the first post-install steps on your system.

The most common SSH implementation is OpenSSH server, and that's exactly what you want to install.

Log in with your standard username and password, and run the following command to install openssh-server. You should be using the same username that you specified when installing Ubuntu, as it will be the only account with sudo privileges to run commands as root:

ubuntu$ sudo apt-get install openssh-server

[sudo] password for greys:

Readingpackage lists... Done

Building dependency tree

Reading state information... Done

Suggested packages:

  rssh molly-guard openssh-blacklist openssh-blacklist-extra

The following NEW packages will be installed:

  openssh-server

0 upgraded, 1 newly installed, 0 to remove and 75 not upgraded.

Need to get 285kB of archives.

After this operation, 782kB of additional disk space will be used.

Get:1 http://ie.archive.ubuntu.com jaunty/main openssh-server 1:5.1p1-5ubuntu1 [

285kB]

Fetched 285kB in 0s (345kB/s)

Preconfiguring packages ...

Selecting previously deselected package openssh-server.

(Readingdatabase ... 101998 files and directories currently installed.)

Unpacking openssh-server (from .../openssh-server_1%3a5.1p1-5ubuntu1_i386.deb) .

..

Processing triggers for ufw ...

Processing triggers for man-db ...

Setting up openssh-server (1:5.1p1-5ubuntu1) ...

Creating SSH2 RSA key; this may take some time ...

Creating SSH2 DSA key; this may take some time ...

 * Restarting OpenBSD Secure Shell server sshd                           [ OK ]

Verifying your SSH server works

While you're still on your local desktop session, you can use the ps command to confirm that SSH daemon (sshd) is running:

ubuntu$ ps -aef | grep sshd

root     24114     1  0 15:18 ?        00:00:00 /usr/sbin/sshd

Now that you see it's there, it's time to try connecting:

ubuntu$ ssh localhost

Since this is the first time you're trying to connect using SSH, you'll have to answer yes to the following question:

The authenticity of host 'localhost (::1)' can't be established.

RSA key fingerprint is 18:4d:96:b3:0d:25:00:c8:a1:a3:84:5c:9f:1c:0d:a5.

Are you sure you want to continue connecting (yes/no)? yes

… you'll then be prompted for your own password (remember, the system treats such connection request as if you were connecting remotely, so it can't trust you without confirming your password):

Warning: Permanently added 'localhost' (RSA) to the list of known hosts.

greys@localhost's password:

.. and finally you'll see the usual Ubuntu (Jaunty in this example) banner and prompt:

Linux ubuntu 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009 i686

 

The programs included with the Ubuntu system are free software;

the exact distribution terms for each program are described in the

individual files in /usr/share/doc/*/copyright.

 

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by

applicable law.

 

To access official Ubuntu documentation, please visit:

 

http://help.ubuntu.com/

 

Last login: Fri May 15 15:18:34 2009 from ubuntu

ubuntu$

That's it, providing you have your networking configured and you know your IP address or hostname, you can start connecting to your Ubuntu box from remote systems, using the same command.  Enjoy!

See also:

Please share:

转载于:https://www.cnblogs.com/sjliu/archive/2012/03/30/2425384.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值