Hello so I'm completely new to Ubuntu and I wanted to copy folders to my network drive. I understand how to copy files normally but I can't seem to copy over files to my network drive.

sudo cp /home/adam/file.txt smb://nas/main/

It says no such directory exists. I can navigate to the location through the file explorer.

EDIT2: Solution provided by RoVo works. I mounted the network drive permanently by editing the /etc/fstab file and adding the line to the end.

I can now transfer files with:

sudo cp /home/adam/file.txt /media/networkdrive
  • Navigate to the folder main and check path from properties and see if it matches in your command.
    – Mahesh K K
    Jun 8, 2017 at 12:57
  • Hi Adam, could you run "lsblk" and "mount" from the command line and pastebin the results for me?
    – Laice
    Jun 8, 2017 at 13:47
  • Please edit your question and add the output of the commands Laice requested. Make sure you run the after navigating to the location through the file explorer.
    – terdon
    Jun 8, 2017 at 14:39
  • @terdon I've ran the commands and edited the results into the post.
    – Adam
    Jun 8, 2017 at 14:51
  • Woah, wait. You say it's running in a VM in your NAS!? What OS is this? What is the guest OS, what is the host OS, which OS is giving you access to the network drive? Also, what is /media/ubvi/Ubuntu 16.04.2 LTS? Is that a mounted CD or is that your network drive? How is this "network drive" set up?
    – terdon
    Jun 8, 2017 at 15:00

3 Answers 3


You cannot cd to a smb share like this.
Nautilus/Nemo can do that, because it uses a virtual file system (gvfs) in the background and mounts the share to a folder somewhere in your file system automatically.

After you fired Nautilus/Nemo to mount it, you could go to /run/user/1000/gvfs/[...] (compare your mount output) and voilà. You should see the smb share there.

From the terminal without Nautilus/Nemo you need to mount the smb drive manually. There are several options doing so.

Most common option afaik is using cifs. smbfs is an alternative. Alternatives for mounting smb in userspace (without the need of having sudo rights or being root) are described here or here or here.

Install cifs-utils:

sudo apt-get install cifs-utils

Then mount your drive

--> either temporarily:

sudo mount -t cifs -o <Options> //<Server>/<Sharename> <Mountpoint> 

Note: <MountPoint> must exist.


sudo mount -t cifs -o credentials=~/.smbcredentials //nas/shared_folder /media/nas_shared

with ~/.smbcredentials being just a regular text file with following content:

username=<username of the share>
password=<password of the share>

Leave out the -o credentials=[...] part if it's a public share without login.

--> or permanent using fstab:

//<Server>/<Sharename> <Mountpoint> cifs credentials=/home/user/.smbcredentials  0 0

Then you can cd to <Mountpoint>.

Get more information from the Ubuntu WIKI.

  • What username and password is required? The drive is public on the network. When I try to mount it temporarily it gives me a mount error(6): No such device or address
    – Adam
    Jun 8, 2017 at 16:02
  • The ones of the Shared Folder of the NAS. Not needed if its open share. Then leave it out
    – pLumo
    Jun 8, 2017 at 16:22

When a drive is mounted by a user inside the Ubuntu desktop, fuse will mount this to /media.

Check the output of:




to check that the location is mounted.

Secondly, you should try navigating to the path using "cd" in the command line to see if you're able to browse there normally.

Kind Regards


Since you can navigate to the shared folder using Nautilus (your file explorer), that means the SMB share is already mounted (which is done automatically in recent Ubuntu versions). So if you will copy only once, then no need to create another mount, whether a temporary one, let alone a permanent one. And so now, the question is: where is the SMB (automatically) mounted? I got the answer here: https://askubuntu.com/a/616707/402539

Navigate to /run/user/XXXX/gvfs/smb-share:server=$SERVER_NAME

where XXXX is some user ID, e.g. 1000, $SERVER_NAME is the name of the shared server. It's a long name, maybe fine for using once, as in my case. But if you plan to use it many times, then a more permanent solution may be better (a mount with a more friendly name)

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.