SSH in Slackware and Arch – a Brief How-To

Let me state right out in the open here that my knowledge of computer networking is lacking. I’m learning as I go.

For most of the time that I’ve used computers in my home, I’ve only had one machine going at any given time. This past year or so, though, I’ve gained two more systems in addition to my main system. I have a laptop and a shop system up and running now in my home. The laptop connects via Ethernet or wireless. The shop system, which is outside in my workshop connects via wireless 100% of the time.

The main OS on all three of these systems is Slackware. For a year now, I’ve been running back and forth with thumb drives or CDs filled with data to keep the systems in sync with one another; mostly my personal documents, music, and Mozilla settings. I occasionally use DropBox for small files, but it’s not feasible for larger stuff due to its slow upload speeds. Cloud computing ain’t never going to work as long as ISPs throttle upload speeds.

Anyway, back when I first got the laptop, I attempted to network it with my main system. I failed miserably and ended up throwing in the towel. You can read about that learning experience in this long thread at Scot’s Newsletter Forums – Bruno’s All Things Linux. You’ll see that quite a few folks there were trying to help the dunderhead get his systems linked. Well, I finally succeeded just this past weekend.

Sometimes, you just have to walk away from a problem for a while. ;)

Here’s how I finally got it working using ssh:

  • Make sure that the ssh daemon script is executable so that it will run at boot up

#chmod 755 /etc/rc.d/rc.sshd

  • Modify the /etc/ssh/ssh_config as follows:

#vim /etc/ssh/ssh_config

<snip>

#   Port 22
Port <your port choice>
#   Protocol 2,1
Protocol 2

</snip>

*Either un-comment and change the default port setting  and the protocol or just add a line, as I did.

The purpose of this is mostly for security. Changing the port to a port of your choosing enhances your “security by obscurity” chances. Changing to to Protocol 2 is recommended because there are security flaws in Protocol 1.

  • Modify the /etc/ssh/sshd_config as follows:

#vim /etc/ssh/sshd_config

<snip>

#Port 22
 Port <your port choice>
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

# The default requires explicit activation of protocol 1
 Protocol 2

</snip>

  • In your router’s Administration preferences (see your manufacturer’s instructions) you’ll need to set each device you plan on linking via ssh to use a static IP address. This has nothing to do with your ISP’s assigned IP address. This is just your home network we’re talking about here. The router assigns an IP to each device hooked to it. In order to ssh into remote devices, you’ll need to make sure the devices’ IP addresses don’t change (static).

That’s it. You are ssh’ing now, my friends.

It’s easy to access your remote machines now.

$ssh <username>@<device name>

Password: *********

The username is the name of the account that your are trying to access on the remote machine, say your wife Debbie’s account. The device name is the domain name of the device. Like this…

#ssh debbie@debbieslaptop01

Once you enter the password for Debbie’s account, you’ll have access to her user data and privileges.

In Arch Linux, the process is a bit simpler. First, make sure you have openssh installed on your Arch system. You still need to modify the ssh_config and sshd_config files in a similar fashion, but the getting the daemon to run at boot time is as simple as just adding “ssh” to your /etc/rc.conf file.

You can manipulate (edit, backup, copy, etc.) files on remote machines using ssh from the command line. However, to transfer files between machines, you might want to use ftp. It’s easier, in my opinion. Personally, I use gFTP in Slackware and Arch for this. There are many other choices out there, though. Use whatever works best for you.

So, there you have it. My next project is going to be adding my printer to my router’s USB connection and setting it up as a network printer for all three of my systems.

Stay tuned…

~Eric

Further reading:

SSH Tutorial for Linux

SSH Best Practices

SSH Man Page

About these ads

7 Comments on “SSH in Slackware and Arch – a Brief How-To”

  1. comhack says:

    Excellent guide Eric!!

  2. B-o-B De Mars says:

    Although you don’t specify the port # you used, not using port 22 will reduce a lot of script kiddy noise.

    Also, you should not allow root logins.

    Add

    PermitRootLogin no

    to you sshd_config to deny root logins


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

Follow

Get every new post delivered to your Inbox.

Join 40 other followers