Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got one desktop computer Ubuntu 11.04 with an external USB drive mounted on it on the home WRT54L Linux network (, and when I arrive at home with my laptop, I want to be able to mount the external USB drive from my Ubuntu 11.04 laptop ( to the desktop, without having to unplug it from the desktop, that is accessing it.

Is it possible to send, via a terminal command, a remote mount command to the desktop usb drive from my laptop? Ideally something that creates a local mountpoint I can just call locally from the programs installed in my laptop, like:

username@laptop ~ "mount the drive so the laptop can see it"
username@laptop ~ ./myprograminlaptop /my/file/which/is/actually/on/the/desktop/file.txt

Can I automate this process every time the laptop is connected to the home network?

share|improve this question
up vote 1 down vote accepted

You need to use ssh for that - run sudo apt-get install ssh on both machines.

Then, you just have to go to nautilus on your laptop, File->Connect to Server..., select "SSH", enter the external IP of the desktop into the Server input box, the port is 22, the folder is /media/, the username is your username on your desktop. Click "Connect", you'll be asked for your desktop password.

To mount the drive, open up the terminal, type in ssh yourusernameondesktop@yourdesktopsip, enter the password, and use the mount command.

sudo mkdir /media/flashdrive
sudo mount /dev/devicename /media/flashdrive

Make sure your password is safe - remote access can be used against you.

Note: I assumed that you are in a different network because you mentioned your home. Please clarify that.

share|improve this answer
ssh installs both openssh-server and openssh-client. – Abhay Rana Jun 24 '11 at 6:44
@Capt.Nemo Won't hurt, less typing. It is only around 930 kb in total I think. – nickguletskii Jun 24 '11 at 6:57
I didn't know about ssh until I read this. Thought it might help others :) – Abhay Rana Jun 24 '11 at 7:02
The new nautilus doesn't have the ssh option, but it still works if you put in ssh://hostname:port. @DebanjanBasu – Wilf Feb 9 '14 at 17:36

Here is an easy GUI solution:

On the server, where we have attached the USB drive open Nautilus and browse to the mount point of the USB drive (usually found in /media/). In the right click context menu on this folder open Sharing Options, tick Share this folder, give a sensible name for the share, and Create Share

enter image description here

On the remote, i.e. your laptop, open Nautilus to browse the Network for the share as named above. On mouse double-click this will be mounted as a network drive on your laptop, and it will appear as an icon on the desktop.

enter image description here

To mount a samba share as non root user in your home directory to have access from all applications you may want to have a look at smbnetfs.

In case you did not set your USB-drive to auto-mount you will be able to mount it remotely by using SSH (after having installed openssh-server Install openssh-server on your desktop).

share|improve this answer
This doesn't mention how to remotely mount the drive if it isn't mounted. – Azendale Jun 23 '11 at 23:30
@Azendale: USB-drives usually are automounted - see edit. – Takkat Jun 24 '11 at 6:13

You can use SFTP, which uses the more secure ssh (encrypts everything, including login credentials), and seems to be faster than the protocols that Takkat's answer uses.

First, on the machine with the Disk connected to it (the Desktop in this case), install the ssh package.

Then on the machine you want to access the files from (the laptop in this case), Open nautilus. Click the File menu and then Connect to server... For service type, select SSH and put in the IP address of the computer the disk is connected to for the Server field. Optionally, you can check Add bookmark and enter a name to have it always show up in the sidebar. Click connect. You will be asked for your username and password for the Desktop. You will be able to see all the files on your Desktop and access your drive remotely under the /media/ folder.

Screenshot of steps to use SFTP

The remote filesystem is mounted in /home/yourusername/.gvfs/, so you can can use command line tools too. For example, on the laptop: nano /home/avilella/.gvfs/sftp_for_desktop/media/externaldrive/some_text_file.

If the drive isn't already mounted, you can have the Desktop mount it so you can use it by running ssh avilella@ from the laptop (assuming avilella is your desktop username and is the desktop IP). It will ask for your password and then you will have a command prompt for the desktop. Then you can run sudo fdisk -l or sudo blkid to identify which /dev/sdXX partition is your external drive. Then you can run

sudo mkdir -p /media/externaldrive
sudo mount /dev/sdXX /media/externaldrive
share|improve this answer

you may consider using NFS (network file system). It is a special file system that allows a computer to access a remote disk ad use it just like a local disk. It allows a cluster of computers to share the same data. you may want to add a few lines to your /etc/fstab or to manually specify a mount point. after that, you can continue working the usual way. of course you will need a nfs daemon running on the server and to configure the daemon to share what you want, specifying who can access that data and so on (pay attention to your firewall, etc)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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