LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Broblem mounting an smbfs in fstab without username/pass and weird names (https://www.linuxquestions.org/questions/linux-networking-3/broblem-mounting-an-smbfs-in-fstab-without-username-pass-and-weird-names-375473/)

polemon 10-21-2005 01:14 PM

Broblem mounting an smbfs in fstab without username/pass and weird names
 
Hi!

What I need:
there's this windows computer in our network, that has the shared folders 'MSK Archive' and 'MSK Uploads' .
As you can see, those names have a whitespace.
Additionally, i'd like to mount those folders in fstab, without username and password, but i don't know how to do this.

When i mount them from console, i use

'smbmount //jkbox/MSK\ Archive /home/polemon/msk-o guest'

or, i can put the host in quotes

'smbmount "//jkbox/MSK Archive" /home/polemon/msk-o guest'

and it all works fine.

But i need them every day, so i'd like to mount those folders at startup, with fstab.

Please tell me how i can do it.

MensaWater 10-21-2005 01:25 PM

I haven't used them but "mount" manual page mentions smbfs and smbmount. Try checking out:

man mount
- Do locate for smb

man smbmount
- Do locate for fstab

The latter talks about using credientials so you don't have to include passwords in fstab.

polemon 10-21-2005 02:08 PM

Ok, this is what i entered in my fstab:

//10.85.71.1/MSK\ Archive /home/bereziak/msk/archive smbfs _netdev,pamconsole,auto,exec,users,guest 0 0
//10.85.71.1/MSK\ Uploads /home/bereziak/msk/upload smbfs _netdev,pamconsole,auto,exec,users,guest 0 0

but i still get an error, becuase of the whitespace i suppose...

any ideas how i can avoid this problem?

MensaWater 10-21-2005 02:13 PM

Typically you don't "escape" white space (putting in the "\" in front it) -instead you "quote" it.

Try:
"//10.85.71.1/MSK Archive"

--OR---

'//10.85.71.1/MSK Archive'

at the beginning of the line.


or maybe:
//10.85.71.1/'MSK Archive' (or double quotes)


polemon 10-21-2005 02:26 PM

Hmm, hmm, seems like i just learned something new...
Escaping whitespaces with '\' works in bash though...

and thanks for your help, jilighter!

--polemon

MensaWater 10-21-2005 02:55 PM

No problem.

I'm assuming the quoting fixed it? If so can you specify which one did it so anyone perusing the thread in future will know without having to ask?

FYI: Quoting/escaping is sometimes more of an art than a science. Different utiltiies will use different things and sometimes you have to nest your quoting escaping and get really bizarre looking command lines just to get it right.

A perfect example:
How to pipe find output into xargs when some of the files have spaces in their names (Oracle is retarded - does this and also names thing "core" just to annoy *NIX users). Had to do this for refreshes on a regular basis.

Normally I'd just do:
find <dirname> -user <UID> |xargs chown <newuser>

The above command would list all files in the specified directory owned by the specifid user and change the owner to the new user specified. It would blow up because of spaces in files as it would think each space was a separate file.

I tried:
find <dirname> -user <UID> |awk '{print "$0"} | xargs chown <newuser>

The awk variable $0 = the entire line.

This did not work though. After some discussion with a coworker we came up with:
find <dirname> -user <UID> |awk '{print "\""$0"\""} | xargs chown <newuser>

Basically had to "quote" the "escapes" that were "escaping" the following "quotes". (Aaaaaaaaaaaaaaaaaaaggggggggggggghhhhhhhhhh!) :mad:

On Unix there's a man page called "regexp" - you can find it on line to get some detail. Unfortunately my Linux distros don't have it. You have to do "man egrep" or "man awk" and search for Regular Expressions to get some info that way.

Most utilities that do any amount of text processing will indicate if they do Regular Expressions and also if they depart from its normal operation (see "man sed" for example) if they do.

polemon 10-25-2005 01:17 PM

I tryed EVERYTHING, Single quotes, double quotes, whole path to share, just the share name, and the combinations of them, nothing worked.

But i found a nice workaround for my problem:

i let the folders mount after init, with a shellscript.

i placed the smbmount lines in /etc/rc.d/rc.local works fine now!


All times are GMT -5. The time now is 01:38 AM.