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
Best Answer
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 yourmount
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:
Then mount your drive
--> either temporarily:
Note:
<MountPoint>
must exist.e.g.
with ~/.smbcredentials being just a regular text file with following content:
Leave out the
-o credentials=[...]
part if it's a public share without login.--> or permanent using fstab:
Then you can cd to
<Mountpoint>
.Get more information from the Ubuntu WIKI.