You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.

Introduction to Linux - A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.

This is short guide to explain howto get ssh going between to slackware or other NIX boxes. I am going to guide you through setting up ssh, but I am not going to explain the why's and wherefores over every thing regarding ssh. there are far more knowledgeable people than I that can do that. This is intended to get you going quickly.

SSH uses public/private keys to authenticate connections. This verifies who the hosts are and ssh uses a high level of encryption. SCP used ssh for remote file copies.

You will need to perform the step on both/all machines

Usage

Code:

ssh <IP/hostname>

to forward X apps

Code:

ssh -X <IP/hostname>

for other user names

Code:

ssh -X <username>@<remotehost>
scp <files> <remotehosts>:/<directory>

multiple files

Code:

scp -rp <files> <remotehost>:/directory

Configuration
in slack the default config is fine. However, in other linuxs make sure in /etc/ssh/ssh_conf and /etc/ssh/ssh_conf that ssh protocol 2 is being used - this is more secure.

Host Keys
Hosts need to have a way to identify themselves that if verifiable:

first get it running on both boxes:

Code:

chmod +x /etc/rc.d/rc.sshd

not reboot boot or issue /etc/rc.d/rc.sshd start.

then you need to generate your HOST keys (I will use RSA though you may use DSA):

Code:

cd /etc/ssh
ssh-keygen -t rsa -b 2048 -f ssh_host_rsa_key

over write the existing keys.
When asked for passphare dont use one - this is for machine to machine. machines can't type.

Known Hosts

At this point you should be able to ssh and scp between machines easily.... but you will be asked about accepting the public key the 1st time you want to to remote copy/login. this will be put in /root/.ssh

Okay so your machines know about each other.... what about this password stuff?? Bit trying?

ok

Code:

cd /root/.ssh/
ssh-keygen -t rsa

Accept the default location. (/root/.ssh/id_rsa)

This time use a pass phrase of your choice.
The passphrase will be used to authenticate rather than username/passwd. to make this work we need to copy to id_rsa.pub from one host to the other's authorized keys:

Code:

scp id_rsa.pub 192.168.0.12:/root/.ssh/authorized_keys

Put in your IP address / host name rather than 192.168.0.12. after you've done this on both hosts try doing an ssh from one box to another. You will be prompted for the pass phrase of the sending machine's user's ssh key.

No passwords - still Secure
Ok so now you just have to use the passphrases. not enough?? ok

So run

Code:

ssh-agent
ssh-add

ssh add will prompt you for the passphrase you generated for the system you are on now.
Now try a to ssh to the other host. hopefully you should be automagically logged in without passwords...

Running ssh-agent
Okay, slackware doesnt have a .bash_profile by default. ssh-agent is the things that passes the pass phrases....

Lets create one.

cd to /root

vi .bash_profile (note the . )

type in eval `ssh-agent`
or add to your existing profile.

if it's a new profile chmod 400 it.

now go for a reboot.

next time you log in type ssh-add to add your passphrase again. and you will not have to used passwords in ssh until you next reboot....

magic

However, each time you log in a new instance of ssh-agent will be loaded. I found this which is great: