I have two laptops running Ubuntu 12.04. Both connect to the same WIFI network to access internet.

How do I connect them to each other so that I can access files on one from another and vice versa?

Also, how do I manage the user permissions, etc. on them?


Share files between 2 Ubuntu computers

If you have two computers running Ubuntu on the same network, it would be an good idea to use openssh to share files between them.

On the server (the computer with the files you want to access), run:

sudo apt install openssh-server

On the client you should have ssh installed already (if for some reason it's not install, run sudo apt install openssh-client).

Then you need to figure out the IP of the computer you want to connect to. Most of the time it's something like 192.168.1.x. To find out the IP, run ifconfig and look for the "wl..." interface (or "eth..." if you're connected over Ethernet cable).

On the client, open Nautilus (Super+E) and go to “File -> Connect to Server”.

Enter sftp://<the_IP_of_the_server>

Ubuntu 16 Connect to Server dialog

On older version of Ubuntu, you could pick the folder you wish to share. As of Ubuntu 16, if you don't specify a path after the IP, you'll get the home directory. For a specific directory outside of the home dir of the user you're connecting as, you need to type its path.

Note that it could take some time to connect, depending on the size of the folder directory.

You'll be prompted for the user/password of the computer you want to connect to.

The name of the directory will become a bookmark in Nautilus.

You should have read/write permissions.

| improve this answer | |
  • Thanks for the tip. To connect using the GUI on newer Ubuntu versions and with the Files program, one should click on "Other Locations -> `Connect to Server". The first one appears as the last-item on the left-menu and the second one at the bottom of the screen. – petobens May 10 '19 at 18:15
  • ifconfig deprecated in 18.04. Use ip address show instead – emagar Mar 8 at 6:10

If you do not require encryption you can use python. If you have installed python you can try SimpleHTTPServer. For this

cd /folder/to/share

And then,

python -m SimpleHTTPServer

This will allow sharing through port 8000. The other machine can access the files using http://yourlocalIP:8000


Since python2 is stopped support, here is the command to python3

python3 -m http.server
| improve this answer | |
  • SimpleHTTPServer doesn't seem to work on python 3. Correct me if I'm wrong.. Also, the usual Connect to server option in Nautilus doesn't seem to accept this command – Harsha Mar 23 at 19:24
  • @Harsha I have edited the answer to add python3 command. – Anonymous Platypus Mar 27 at 6:18
  • So now how do we access this from the Nautilus Connect to Server option? – Harsha Mar 27 at 11:59

A Quick Way to Share Folders in Ubuntu


Share a folder between 2 Ubuntu using samba PC's

enter image description here

enter image description here

enter image description here

enter image description here

sudo smbpasswd -a USERNAME
| improve this answer | |
  • 1
    Is that Nautilus? – Brōtsyorfuzthrāx Jan 7 '17 at 9:03
  • 3
    Doesn't work... – Pixel Jun 21 '17 at 9:30
  • If this doesn't work, you can follow the following answer after doing the above, which works. askubuntu.com/a/478224/389479 Things to do with configuration. – kisanme Jan 8 '19 at 13:16
  • @Antinous dunno what you're talking about, plus on ubuntu 18/19 you don't even have the restart session part. you also have to choose a short name without numbers or special characters and then click "create share", once you've done that open up a terminal and type sudo smbpasswd -a tatsu where you replace "tatsu" with the session username you'll want from the other machines, it'll first ask you for your real password, then you create a filesharing password (if you want a lot of people accessing this folder, make it an easy password). then you go to the other ubuntu, go to a file explorer – tatsu Jan 25 '19 at 11:20
  • -> "+ other locations" click on the name you created then click on it's folder you're sharing, this will open up a samba connection, don't leave it as anonymous, select or type the username you created and also use the password you created, you can select "remember forever" and whamo! you've got a seamless browsable editable remote folder in gui. – tatsu Jan 25 '19 at 11:20

It seems like every installation of samba is a bit different. You'll want to tweak around with the settings until you get something that works.

Perhaps this will help though. This is my mount of an ntfs drive:

    path = /media/alpha/
    browseable = yes 
    readonly = no
    guest ok = yes 
    create mask = 0644
    directory mask = 0755
    force user = default
    force group = default

Then I made sure that /media/alpha was mounted with 777 permissions.

Using Samba does this to you... sshfs is better.

Edit: I've recently updated the permissions on my External Drive, and having it mounted as 777 isn't required. Limiting permissions on an ntfs drive is probably another topic.

| improve this answer | |

go to /etc/samba directory and type:

   sudo gedit smb.conf

Then just add this line after workgroup name:

   usershare owner only = false

and exit with saving.

Now restart the services:

   sudo service smbd restart

   sudo service nmbd restart

Now create a samba user:

   sudo smbpasswd -a RAIHAN

and provide password for that user.

That's it!!!

| improve this answer | |

You can achive this securely via SSH, you need to install openssh-server on the host machine from which you want to access the files use following command to install:

sudo apt install openssh-server

Get your local ip address of system which has files you want to access

ip address show

enter image description here

if connected to wifi pick 3: wl01 or in case of Ethernet pick 2: enp3s0

you are done with host, move to the system form which you want to access, open file manager (nautilus) and chose Other Locations at the bottom notice connect to Server input box

enter image description here



and press connect, you will be asked username and password of the user of which files you want to access

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.