Sharing Files Between Computers on a Local Network Using Linux

Written by BinnyVA on July 26, 2008 – 10:47 pm -

Windows has a nice feature in Networking – you just configure the IPs correctly, and the network sharing “magically” works. In Linux we will have to manually configure Samba or some other similar tool to share files between two linux systems – and that’s a bit daunting for a new user. But there is an easier way – using SSH.

SSH or Secure Shell is a program for logging into a remote machine and executing commands on a that machine. Don’t worry – you won’t have to type commands to transfer files – there are GUI clients that supports SSH protocol – for example, the great Konqueror.

SSH is installed and turned on in most distros – so chances are you are running an SSH server at the moment. But if its not installed by default, you can install it using these commands…

In Fedora/Red Hat

yum install openssh

In Ubuntu/Debian

apt-get install openssh

After installing it, you have to activate it in the Services configuration utility. Once that is done, SSH will turned on at boot. Make sure the remote machine have SSH installed and running before trying to connect to it.

An Example Implementation

I use SSH to transfer files between my system and my brothers system. This will give you an overview of the network…

Home Network

Both the systems have SSH enabled. Now if I want to get some files from my brother’s system, all I have to do is open Konqueror and enter this address in the Address bar: fish://username@

That is fish://[Remote User]@[Remote Machine’s IP/Name].

This will show a password prompt – where you have to input the password of the remote user. Once that is done, you will see all the files in the remote machine that is accessable by the user you logged in as. All operation you are used to in Konqueror are still supported – Copy/Paste, Drag and Drop etc – they will work between the local system and the remote machine.

If you are a Gnome user, this is possible in Nautilus as well. Instead of fish://username@ , you have to enter ssh://username@ in the address bar – protocol is ssh:// instead of fish://.


Keep in mind that this is practical only for small home networks. If you are implementing a large network with permission settings, shares and stuff, go with Samba. SSH is not a choice there.

Tags: , , , , , ,
Posted in KDE, Networking, Tools | 4 Comments »

Script to Backup Files Over a Network Using Rsync

Written by BinnyVA on June 4, 2008 – 9:47 pm -


This script will backup the specified files to another computer on your network. You can also use this to send your files to a remote server. This script compliments the last Rsync Backup script. Its possible to combine both the script together, I prefer to keep them separate.

The Setup

For this to work, you need to have a password-less login system over ssh. You should configure the remote system to accept your credentials by giving your public key to the remote server. If you are not sure how to do that, just leave a comment and I’ll make a post on how to set it up.

The configuration file is the same format as the one used in the last Rsync script. But in this case, the file name will be ‘rsyncnetworkbackup.config‘.

The Code


#The folder on the remote system that must be used to store the data
$backup_folder = '/home/neo/Backup'; #Final '/' must NOT be there.
# The user for whom we have set up the key based login
$backup_user = 'neo';
# The IP address/domain name of the remote system.
$backup_server = '';

use File::Basename;
my $config_file = dirname($0) . "/rsyncnetworkbackup.config";
my @all_locations = removeComments(getFileContents($config_file));

foreach my $folder_locations (@all_locations) {
	my($folder,$backup_location) = split(/\s+/,$folder_locations);
	print "Backing up $folder to $backup_location ... ";
	`rsync -avze ssh $folder $backup_user\@$backup_server:\"$backup_folder/$backup_location\"`;
	print "Done\n";

sub getFileContents {
	my $file = shift;
	my @lines;
	open (FILE,$file) || die("Can't open '$file': $!");

	return @lines;

sub removeComments {
	my @lines = @_;

	@cleaned = grep(!/^\s*#/, @lines); #Remove Comments
	@cleaned = grep(!/^\s*$/, @cleaned); #Remove Empty lines

	return @cleaned;

Tags: , , , , ,
Posted in Networking, Scripting, Shell Scripts | 9 Comments »