LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 11-26-2017, 05:51 PM   #1
bmxakias
Member
 
Registered: Jan 2016
Posts: 254

Rep: Reputation: Disabled
Question 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
 
Old 11-26-2017, 06:29 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,369

Rep: Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753
I'd start by looking at the first answer here https://superuser.com/questions/3204...ic-user-rights.
See also the man page eg https://linux.die.net/man/8/mount
 
Old 11-26-2017, 06:48 PM   #3
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Put the mount in /etc/fstab with the correct permissions, or specify them in the mount command line.
 
Old 11-26-2017, 07:15 PM   #4
bmxakias
Member
 
Registered: Jan 2016
Posts: 254

Original Poster
Rep: Reputation: Disabled
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.....
 
Old 11-26-2017, 07:20 PM   #5
bmxakias
Member
 
Registered: Jan 2016
Posts: 254

Original Poster
Rep: Reputation: Disabled
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
 
Old 11-26-2017, 07:49 PM   #6
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Try using the 'noauto' option in fstab. If it's an automount, and the drive isn't available, the system won't boot.
 
Old 11-26-2017, 07:55 PM   #7
bmxakias
Member
 
Registered: Jan 2016
Posts: 254

Original Poster
Rep: Reputation: Disabled
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
 
Old 11-26-2017, 08:15 PM   #8
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Yes, that should work for the problem with booting.
 
Old 11-26-2017, 08:54 PM   #9
bmxakias
Member
 
Registered: Jan 2016
Posts: 254

Original Poster
Rep: Reputation: Disabled
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.
 
Old 11-26-2017, 09:47 PM   #10
bmxakias
Member
 
Registered: Jan 2016
Posts: 254

Original Poster
Rep: Reputation: Disabled
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
 
Old 11-26-2017, 10:52 PM   #11
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Just add the options to the mount command in the script.
 
Old 11-27-2017, 02:09 AM   #12
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,876
Blog Entries: 1

Rep: Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078
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.
 
Old 11-27-2017, 11:06 AM   #13
bmxakias
Member
 
Registered: Jan 2016
Posts: 254

Original Poster
Rep: Reputation: Disabled
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
 
Old 11-27-2017, 11:48 AM   #14
bmxakias
Member
 
Registered: Jan 2016
Posts: 254

Original Poster
Rep: Reputation: Disabled
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.
 
Old 11-27-2017, 03:17 PM   #15
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
See this: https://unix.stackexchange.com/quest...-missing-value
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Map/Mount Volume Group Folder to Volume Group Folder??? Led Zappa Linux - Newbie 4 09-21-2013 04:12 PM
Change owner, group and permission settings on file and folder creation?? helptonewbie Linux - Newbie 9 12-17-2007 03:03 PM
missing folder permission, owner and group tritonw Linux - General 4 10-28-2007 11:21 PM
folder owner/group weird curos Slackware - Installation 1 07-18-2005 07:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration