Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to
LinuxQuestions.org , a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free.
Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please
contact us . If you need to reset your password,
click here .
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a
virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month.
Click here for more info.
11-26-2017, 05:51 PM
#1
Member
Registered: Jan 2016
Posts: 254
Rep:
Hou to mount a folder with the current owner:group and folder permissions?
Hello
I need to mount a folder using a bash script and i am using:
Code:
mount 123.456.789.000:/folder1 /home/blabla/afolder/here/public -t namehere
After the mount i am getting the public folder with owner:group set as root [0] and permissions 0755
The public folder had before the mount owner:group set as nginx [1000] and permissions 2750
How can i adjust the mount command so i can mount it with the above permissions?
Thank you
11-26-2017, 06:29 PM
#2
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,369
11-26-2017, 06:48 PM
#3
LQ Guru
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Put the mount in /etc/fstab with the correct permissions, or specify them in the mount command line.
11-26-2017, 07:15 PM
#4
Member
Registered: Jan 2016
Posts: 254
Original Poster
Rep:
Quote:
Put the mount in /etc/fstab
I try it but doesn't work as it was refused to boot
I was test on Centos 7.4 this (the mount is for glusterfs that i am testing):
Quote:
123.456.789.000:/folder1 /home/blabla/afolder/here/public defaults,_netdev 0 0
or
Quote:
123.456.789.000:/folder1 /home/blabla/afolder/here/public _netdev 0 0
or
Quote:
123.456.789.000:/folder1 /home/blabla/afolder/here/public defaults 0 0
Quote:
specify them in the mount command line
Yup that's what i am looking for.....
11-26-2017, 07:20 PM
#5
Member
Registered: Jan 2016
Posts: 254
Original Poster
Rep:
For the /etc/fstab after reading the info from the links that you provide me i think that something like this may work?
Quote:
123.456.789.000:/folder1 /home/blabla/afolder/here/public umask=0022,gid=1000,uid=1000,defaults,_netdev 0 0
But uid set doesn't work for ext4 partitions as mine?
For the script command something like?:
Quote:
mount 123.456.789.000:/folder1 /home/blabla/afolder/here/public -t glusterfs -o umask=0022,gid=1000,uid=1000
11-26-2017, 07:49 PM
#6
LQ Guru
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Try using the 'noauto' option in fstab. If it's an automount, and the drive isn't available, the system won't boot.
11-26-2017, 07:55 PM
#7
Member
Registered: Jan 2016
Posts: 254
Original Poster
Rep:
Quote:
Try using the 'noauto' option in fstab.
Replacing defaults parameter like this?
Quote:
123.456.789.000:/folder1 /home/blabla/afolder/here/public umask=0022,gid=1000,uid=1000,noauto,_netdev 0 0
11-26-2017, 08:15 PM
#8
LQ Guru
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Yes, that should work for the problem with booting.
11-26-2017, 08:54 PM
#9
Member
Registered: Jan 2016
Posts: 254
Original Poster
Rep:
Nope it doesn't work
I just start to use it as simple as possible with no permissions parameters just to get it mounted and then i will adjust that as it is more easy.....
I just add the ext4 parameter on the fstab and now it always boot with no issues but it doesn't mount....
I think it has to do with networking or another service that it must wait for.....
Can i add a delay on it?
Quote:
host1:/folder1 /home/blabla/afolder/here/public ext4 noauto,_netdev 0 0
it should run after networking and maybe after glusterd service .....
The boot log has this inside:
Quote:
mount: special device host1:/folder1 does not exist
So i am 99% sure that it needs a delay as manually it works...
Last edited by bmxakias; 11-26-2017 at 09:16 PM .
11-26-2017, 09:47 PM
#10
Member
Registered: Jan 2016
Posts: 254
Original Poster
Rep:
Yup i just verify that
If i set the cronjob as @reboot it doesn't work but if i add a delay of 5 seconds it works....I think it waits for glusterd service to start !
So i will try at the moment the ugly solution using the bash script.....
So i need some help please to adjust my command:
Quote:
mount host1:/folder1 /home/blabla/afolder/here/public -t glusterfs
So i can get for public folder the owner:group nginx [1000] and folder permissions of 2750
Thank you
11-26-2017, 10:52 PM
#11
LQ Guru
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Just add the options to the mount command in the script.
11-27-2017, 02:09 AM
#12
LQ Guru
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,876
If you want it to mount at boot, substitute nofail for noauto in fstab. Likely you will find it mounted by the time you login.
11-27-2017, 11:06 AM
#13
Member
Registered: Jan 2016
Posts: 254
Original Poster
Rep:
Quote:
Just add the options to the mount command in the script.
But i was reading on the net that uid can't be set for ext4
May i have en example so i can test it?
Quote:
If you want it to mount at boot, substitute nofail for noauto in fstab.
Like this?
Quote:
host1:/folder1 /home/blabla/afolder/here/public ext4 nofail,_netdev 0 0
11-27-2017, 11:48 AM
#14
Member
Registered: Jan 2016
Posts: 254
Original Poster
Rep:
O my god that did the trick. - It works now !
Quote:
host1:/folder1 /home/blabla/afolder/here/public nofail,_netdev 0 0
Do you recommend me any other system parameter there?
Thank you so much !
But how can i add now the permissions as ext4 if i am not wrong doesn't support uid to be set there?
my target is to set owner:group to nginx [1000] and folder permissions to 2750
Last edited by bmxakias; 11-27-2017 at 11:50 AM .
11-27-2017, 03:17 PM
#15
LQ Guru
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
1 members found this post helpful.
All times are GMT -5. The time now is 09:00 PM .
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know .
Latest Threads
LQ News