30

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?

  • 2
    Not to change the subject but sometimes it is easier to just ssh between machines to share files. – N.N. Feb 2 '12 at 14:42
  • askubuntu.com/questions/100790/… – One Zero Jun 26 '12 at 12:26
  • I'm voting to reopen this question because the linked question has no answers. – David Foerster Apr 30 '17 at 16:28
34

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.

17

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

7

A Quick Way to Share Folders in Ubuntu

Objectives:

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
  • 1
    Is that Nautilus? – Shule Jan 7 '17 at 9:03
  • Doesn't work... – Antinous 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 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 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 at 11:20
4

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:

[Alpha]
    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.

1

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!!!

0

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

Enter

sftp://<the_IP_of_the_server>/home/<username>

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

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.