• Check it out - we have a chatbot! Go ask TuxBot a question in the Ask Tuxbot section!

adding windows share in /etc/fstab

jsabo

New Member
Joined
Sep 2, 2022
Messages
5
Reaction score
0
Credits
52
Hi guys

forgive me for asking this question, but i am at my wits end.
I have a windows share i want to add to my /etc/fstab file. But there is spaces in the file path and linux doesn't like the spaces, so it won't mount the filesystem.
example:
\\<server name>\path\to\file name with spaces /path/to/mount/point cifs etc...

it's the 'file name with spaces' that it won't read.
now i tried to encapsulate the path in quotes as thus:
"\\<server name>\path\to\file name with spaces" /path/to/mount/point cifs etc...
but that didn't work. Then i tried putting \040 in the spaces, but because the '\' is the same as the rest of the path, it didn't work either.

\\<server name>\path\to\file\040name\040with\040spaces /path/to/mount/point cifs etc...
So i am looking for help with this. i know there must be a way, i just can't see it.

my system is currently running RHEL 7.6

thank you in advance
 


KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
8,576
Reaction score
7,328
Credits
69,725
I've never done this, so I'm *kinda* guessing. I'd try the quotes elsewhere in the line. Eg.

Code:
/path/to/"file name with spaces"
 
OP
J

jsabo

New Member
Joined
Sep 2, 2022
Messages
5
Reaction score
0
Credits
52
I've never done this, so I'm *kinda* guessing. I'd try the quotes elsewhere in the line. Eg.

Code:
/path/to/"file name with spaces"
Thanks. at this point i'll try anything. let you know if it works
 

PsychoHermit

Member
Joined
Aug 29, 2021
Messages
47
Reaction score
34
Credits
339
Using spaces in directory and file names is just wrong, it causes all kinds of problems. Just because it lets you use spaces doesn't make it a good idea. Replace the spaces with underscores.

--glenn
 
Last edited:

wizardfromoz

Administrator
Staff member
Gold Supporter
Joined
Apr 30, 2017
Messages
8,392
Reaction score
7,296
Credits
33,477
Moving this to Command Line.

Cheers

Wizard
 
MALIBAL Linux Laptops

Linux Laptops Custom Built for You
MALIBAL is an innovative computer manufacturer that produces high-performance, custom laptops for Linux.

For more info, visit: https://www.malibal.com

Staff online


Top