Score:2

How to write the full path to a cifs share on the command line

cn flag

I have mounted a cifs share on my network, and I want to create a symlink to a document on that share. The share is created like this:

sudo mount -t cifs -o username=(username),password=(password),dir_mode=0777,file_mode=0777 "//192.168.0.2/D Share" /mnt/smb_share

Now I can see the share on the “Other Locations” section of Nautilus in mnt/smb_share.

To create a symbolic link: ln [source], [reference]. But how do I write the path to the source? I tried first to list the contents of the folder:

ls mnt/smb_share/Project Backups/

ls: cannot access 'mnt/smb_share/Project': No such file or directory

ls: cannot access 'Backups/': No such file or directory

If I put it in quotes (ls "mnt/smb_share/Project Backups/") I just get a command prompt. Nautilus doesn’t allow me to copy it from the breadcrumbs, and neither does Libre Office.

When I research this, I get a lot of hits for how to create the share, but my question is different.

How do I write the full path to the cifs share for the command line?

Thanks for any help.

Score:4
hr flag

There are 2 things going on here:

  1. mnt is a relative path (relative to the directory you're in when you issue the ls command). If you're not in /, then you need to prepend the / to make it an absolute path 1

  2. you need to either quote (as you tried) or escape the space.

So

ls "/mnt/smb_share/Project Backups/"

or

ls /mnt/smb_share/Project\ Backups/

  1. or construct a correct relative path by going up the directory tree like ../../mnt
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.