Share files between 2 ubuntu computers

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

The setup shouldn’t take more than 2 minutes.

updated for Ibex.

On all the computers you want to share files with copy/paste the following command.

Ubuntu 8.04:

sudo apt-get install openssh-server openssh-client

Ubuntu 8.10:

sudo apt-get install ssh

Then you need to figure out the ip of each the computer you want to connect to.

Most of the time it’s something like 192.168.1.2 or something in that line.

(kde, cli and another option is presented in bottom of thread)

Right-click the network-manager applet on the top panel and choose “connection information” to find it out.

On the computer you want to access the files from, go to “Places -> Connect to Server”.

You’ll get greeted by this window.

Service type should be “SSH””

Server should be the “ip” adress of the pc where the info is on.

Port, enter “22”

Pick the folder you wish to share (could take some time to connect depending on the size of the folder).

The user name of the pc you are connected to

The bookmark will be the name of the folder in nautilus

After that you’ll get a windows where you have to enter a password. That would be the password of the pc you are trying to connect to.

And that’s it.

You should have read/write permissions.

You can also connect to your Ubuntu pc running openssh from windows using “Putty” or from OSX using “Fugu”. It should work the other way around too.

Note: It might be a good ideo to turn of root logins (for security reasons).

In a terminal

sudo gedit /etc/ssh/sshd_config

Change the line “PermitRootLogin yes” to “PermitRootLogin no”.

————–

This won’t be possible for all people (for instance when you use fluxbox), then you could try the things below here or just use “gftp”. It has an easy to use UI.

————–

If you are using Kubuntu, you can connect to the ssh server using konqueror.

Just type

fish://user@server/path/to/folder

So in reality it could something like this

fish://rw@localhost/home/rw

This would bring you to the /home of the server.

or

fish://rw@192.168.1.3/

This would bring you to / of the server.

If you are on fluxbox, openbox, … nautilus won’t be able to handle ssh (or smb). You could still use konqueror but you most likely won’t like that.

Then you could use the cli client of you choice and do

ssh user@server

For me this would be:

ssh rw@192.168.1.3

And you would be able to browse the server using the terminal.

Some basic terminal commands are given here.

However, you could use sshfs to mount the the ssh share as a filesystem.

There are instructions to get it working on the official website, but ubuntu.wordpress.com has a nice how-to.

    • Yuki_Nagato
    • July 7th, 2008

    Excellent. I am now able to “securely” share files between my computers without the need fro removable media.

    Thank you.

    • Bavarian
    • July 7th, 2008

    Nice guide dude 😉

    • linuxowns
    • July 9th, 2008

    Thanks.

    This is one of my favorite posts on this website, because I know a lot of people need this.

    And I believe this is the easiest way (and easiest guide on the internet) to get Ubuntu computers to share files (stream files) with each other.

    • zuheyr alsalihi
    • July 17th, 2008

    Wonderful, thank you. But there are two things that are not clear to me right now:(I just followed what is written)

    1-Do we have to repeat this process each time we login?
    2-How do I disconnect (or do I have to disconnect) if I want to shutdown the connected computer?

    • linuxowns
    • July 17th, 2008

    Hey.

    To answer you questions:

    1. Yes.

    2. There is no need to disconnect if you want to shutdown.

    • richfeat
    • July 20th, 2008

    Excellent post – much easier than smb share

    Just to clarify last comment:
    You don’t have to repeat the whole process each login, just need to click on your chosen bookmark under “Places” or in the left-hand pane of Nautilus. I’m not sure what the :p:p signifies, you just need a sensible bookmark name.

    • linuxowns
    • July 20th, 2008

    The :p :p was me trying to be funny.

    It’s one of those smilies.

    For me it’s not always there, I just repeat it every time.

    It only takes 4-5 seconds, so it’s not a big deal.

    • richfeat
    • July 21st, 2008

    Sorry I didn’t get it – thicko I guess.

    • poliltimmy
    • August 24th, 2008

    Should you get rid of samba before you install SSH?

    • linuxowns
    • August 24th, 2008

    @ Poliltimmy:

    No.

    Samba shouldn’t interfere with Openssh.

    • poliltimmy
    • August 24th, 2008

    I downloaded it. I ran on it the computer my family uses first but then they could see right in to my file system, the whole nine yards. Not an acceptable out come for me. On my computer my account and the user account on the family computer I could access. Just the opposite of my desired outcome. I have tried to remove and reinstall and run them the other way around ( mine first).
    Now I cannot hook up in either direction.

    Couldn’t display “sftp://john@192.168.15.2/home”
    Error: Host key verification failed Please select another viewer and try again. Any suggestions from anyone would welcome.

    • linuxowns
    • August 24th, 2008

    If you have problems with openssh, please ask them on the help forum of your linux distro.

    I would love to help, but I never had that problem, so I’m not sure what causes it.

  1. If you look in your pic above you will see that you indeed have a sftp mount at 192.168.1.14
    this will show you the whole file system of the user’s PC that you have mounted. this is dangerous and although usefull is missing some scripting with something like username=dbott,password=mysecretpassword,uid=1000,mask=000

  2. In your defence, a properly configured system would let permissions deal with it in which case its is safe’ish IE: you should not be able to even read /etc/passwd or shadow etc so if your groups are setup correctly (usually IS NOT SO) then this is a fine idea and much better than SMB

    • Jenifer
    • January 22nd, 2009

    This saved my stuff man! I have to do an emergency reinstall of Ubuntu to try and save my CD-ROM, which doesn’t work, but I don’t have a backup USB device big enough for the stuff on my computer. Now it can all go to my other laptop while I trouble shoot this one. Thanks!

    • Craig
    • January 28th, 2009

    Hi,

    Followed the post easily enough but both laptop and desktop (both wired to the same router) time out when trying to connect. Do you have to have the directories set as shares that you’re connecting to? Thanks.

    • JohnPta
    • February 7th, 2009

    A few questions: It appears to me that my notebook has NO ip address. Is that because I am connected wireless to my router?
    eth0 Link encap:Ethernet HWaddr 00:1a:80:f8:02:31
    inet6 addr: fe80::21a:80ff:fef8:231/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:238 errors:0 dropped:0 overruns:0 frame:0
    TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:18703 (18.7 KB) TX bytes:1836 (1.8 KB)
    Interrupt:16
    The second question is when I connect the two computers could I mess up my wired Internet connection? On my desktop computer?

    • Bill Goldberg
    • February 7th, 2009

    @ JohnPta

    Question 1:

    I presume you did ifconfig to get that output. Use iwconfig instead.

    Question 2: No.

    • JohnPta
    • February 9th, 2009

    Ok as I understand from looking through websites is iwconfig used for wireless networks. I want to connect with a cable to my desktop machine.
    Than I did manage to connect with a cross over cable but at the point of connection the computers are asking me for a password, where and what password is it/ssh looking for??

    • Bill Goldberg
    • February 10th, 2009

    The password ssh is asking for is the one you use to login with on the machine you are connecting to.

    • doboy
    • March 5th, 2009

    thank you so much, i have been trying to connect both machines for so long now using other guides with no luck. try your steps works right away. your a legend

    • Rumbleseat
    • March 26th, 2009

    Any way to connect Ubuntu box to Linux Mint box? I’ve been trying to no avail.

    • metalsmith
    • April 17th, 2009

    I have been trying to hook up a nfs network. This did not work at all but now I can,t connect with openssh either.

    I can connect from the other computer but can not go from the box that I was trying to configure as nfs server.

    I do not believe that I have anything that I edited that is not back the way it was.

    What I am getting is;
    Cannot display location “sftp://slade@192.168.1.xxx/home”
    Host key verification failed
    (I inserted the xxx)

    I autoremoved ssh (using 8.10) and then apt-get installed it back thinking that may help but it did not.

    I also tried connecting with the same box on another partition with Hardy on it and that failed too so it has to be on this box.

    WTF?

    • me
    • April 29th, 2009

    Thanks a lot, very helpful

    • linuxowns
    • April 29th, 2009
  3. Thank you so much! Go ssh!

    • metalsmith
    • May 28th, 2009

    linuxowns,
    Sorry not to get back but it was the end of calving season and the start of branding, no time to breath.

    That fixed it right up. I can see that this may not be good for some but it is just what we need.

    I love this ssh stuff. It is fun.

    • Neel Sen
    • July 15th, 2009

    A Big Thanks To You………Thank You.

    • Arthur
    • September 10th, 2009

    Great guide!
    Way simpler than SMB or NFS

    One thing though:
    Max. transfer speed (for me at least) is around 300-400 Kb/sec

    Is that reasonable for this protocol?
    Anything to take care of in order to get better speeds?

    Thanks in advance!

    • george varghese k
    • December 8th, 2009

    cool man … timely help actually.. keep posting thins like this…..

    • tofu
    • March 4th, 2010

    this worked for me.

    just wanted to say thanks.

    thanks!

    • WAV
    • May 10th, 2010

    Great stuff!

    One question: How would I prevent users from browsing to other parent folders. I have some 20 students with shares in the home folder. I want each to see only his own?

    • Sonal Jain
    • May 16th, 2010

    I want to give read only permission.
    right now i am having read/write permission while using openssh. Could you plz tell me how can i change the permission to read only??

  4. helloo
    plz
    how share files between 2pc in linux(ubuntu)?
    plz send answer to mail(mohamadi.naghmeh@yahoo.com

  5. helloo
    1)How to share url(address) between 2 computers (linux -qnome-ubuntu)?then

    1.a)2 computer can read and write(allow)
    1.b)one computer can read &write but other computer only can read and can not write
    2) how to shre a CDROM between 2 computer (linux-gnome-ubuntu)
    please send answer to my mail:
    mohamadi.naghmeh@yahoo.com

  6. desktop computers these days gets obsolete the day that they are shipped considering how fast technology updates’-`

  7. desktop computers with Intel i5 cores are the best because they are very very fast and great for multitasking ,:-

  8. thanks a lot. much appreciated

    • Habib
    • July 21st, 2011

    Nice guide, thanks a lot
    And Always Open Source!!!

    • niky
    • August 12th, 2011

    Excellent guide! Thanks for sharing.

  9. Thank you very much !!!!!! I was searching about 1 year on russian sites for this !!!

  10. Thank you very much

    • sivakumar
    • June 15th, 2013

    i need to copy paste the data between ubuntu machine by terminal, pls share the details to below mail id, Thank in advance. Thanks & Regards, Sivakumar.

  11. Post writing is also a excitement, if you be acquainted with after that you can
    write otherwise it is difficult to write.

  12. You might be a fantastic website owner. Your website loading swiftness is usually incredible. It sort of feels that you’re performing every exceptional secret. Additionally, The particular articles tend to be must-see. you have performed a fantastic job during this issue!

  13. Все о linux http://linuxfresh.info/

  14. Each show is different and it really depends
    on whos booking it and for the bigger shows with celebrities and bands they need a lot
    of lead-time. No matter what your field, it helps to know what you’re good at,
    but it also helps to recognize what others are good at.
    Wouldn’t it be nice if we could take a magic pill and have a perfect relationship.

  15. Why people still make use of to read news papers when in this technological world all
    is existing on web?

  16. I really like what you guys tend to be up too.
    This sort of clever work and coverage! Keep up the superb works guys I’ve included you guys to my personal blogroll.

  17. I’m curious to find out what blog platform you have been using?
    I’m having some minor security issues with my latest site
    and I would like to find something more safe.
    Do you have any suggestions?

  18. things is going to be quite volatile in the next days. Timor-Leste could be the logical population for digicube to be put to use

  19. A través de nuestra Asistencia Online puedes tanto encontrar manuales de instrucciones, preguntas frecuentes consejos de limpieza y mantenimiento, como comprar online accesorios y repuestos originales para tu electrodoméstico. Introduce el modelo de producto (E-Nr) del electrodoméstico y el Servicio de Asistencia Técnica te mostrará toda la información disponible sobre el aparato. Reparación proporcionada por técnicos oficiales Bosch, especialmente formados para reparar tus electrodomésticos.

  20. Hey, sometimes I get a 500 server message when I browse your site. Just a heads up, regards

  21. I visit daily a few blogs and blogs to read posts, however this
    webpage provides feature based posts.

Leave a comment