Posted by: isaraffee | August 10, 2009

Exploring ssh in Sabayon Linux

SSH in Sabayon

Like in other distributions, to use secure shell i.e ssh, the ssd daemons sshd must be running:

sabayonx86 ~ # ps -ef|grep ssh

root 19161 12873 0 11:47 pts/1 00:00:00 grep ssh

From the output shown above, ssh server or client is not running

If ssh not running, you cannot run any ssh commands:

sabayonx86 dev # ssh sabayonx86

ssh: connect to host sabayonx86 port 22: Connection refused

To check if ssh is installed, type:

sabayonx86 dev # emerge –search ssh

Searching…

[ Results for search key : ssh ]

[ Applications found : 26 ]

* net-misc/openssh

Latest version available: 5.2_p1-r1

Latest version installed: 4.4_p1-r4

Size of files: 1,244 kB

Homepage: http://www.openssh.org/

Description: Port of OpenBSD’s free SSH release

License: as-is

<output truncated for brevity>

The output shows that the openssh package is installed.

To locate sshd, type:

sabayonx86 ~ # which sshd

/usr/sbin/sshd

To locate other files which are assocated with ssh, type:

sabayonx86 ~ # equery files net-misc/openssh

!!! SELinux module not found. Please verify that it was installed.

[ Searching for packages matching net-misc/openssh… ]

* Contents of net-misc/openssh-4.4_p1-r4:

/etc

/etc/conf.d

/etc/conf.d/sshd

/etc/init.d

/etc/init.d/sshd

/etc/pam.d

/etc/pam.d/sshd

/etc/ssh

/etc/ssh/moduli

/etc/ssh/ssh_config

/etc/ssh/sshd_config

/usr

/usr/bin

/usr/bin/scp

/usr/bin/sftp

/usr/bin/slogin -> ./ssh

/usr/bin/ssh

/usr/bin/ssh-add

/usr/bin/ssh-agent

/usr/bin/ssh-copy-id

/usr/bin/ssh-keygen

/usr/bin/ssh-keyscan

/usr/lib

/usr/lib/misc

/usr/lib/misc/sftp-server

/usr/lib/misc/ssh-keysign

/usr/sbin

/usr/sbin/sshd

<output truncated for clarity>

A very useful file is the /etc/init.d/sshd file, which users can start, stop the ssh services.

sabayonx86 ~ # cd /etc/init.d

sabayonx86 init.d # ./sshd start

* Generating Hostkey…

Generating public/private rsa1 key pair.

Your identification has been saved in /etc/ssh/ssh_host_key.

Your public key has been saved in /etc/ssh/ssh_host_key.pub.

The key fingerprint is:

a4:6a:f9:e6:cb:16:3d:eb:fb:97:56:9b:76:85:29:4d root@sabayonx86

  • Starting sshd …

After we have start the ssh service, we can now execute some ssh commands:

ssh into user ismail

sabayonx86 init.d # ssh ismail@sabayonx86

Password:

Last login: Tue Mar 31 11:04:58 2009

ismail@sabayonx86 ~ $

Note Sabayon’s default ssh settings prevent ssh into root user account.

To secure copy from root user to user ismail, type:

sabayonx86 ~ # scp hello ismail@sabayonx86:/home/ismail

Password:

hello 100% 40 0.0KB/s 00:00

To secure copy from user ismail to root, type:

sabayonx86 ~ # scp ismail@sabayonx86:/home/ismail/test.txt /root/

Password:

test.txt 100% 100 0.1KB/s 00:00

Verifying the sceure copy, type:

sabayonx86 ~ # ll test.txt

-rw-r–r– 1 root root 100 2009-04-10 12:13 test.txt

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: