LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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: 244

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: Centos 7.7 (?), Centos 8.1
Posts: 17,873

Rep: Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600
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,513

Rep: Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009
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: 244

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: 244

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,513

Rep: Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009
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: 244

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,513

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

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: 244

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,513

Rep: Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009
Just add the options to the mount command in the script.
 
Old 11-27-2017, 02:09 AM   #12
mrmazda
Senior Member
 
Registered: Aug 2016
Location: USA
Distribution: openSUSE, Debian, Knoppix, Mageia, Fedora, others
Posts: 3,337
Blog Entries: 1

Rep: Reputation: 1123Reputation: 1123Reputation: 1123Reputation: 1123Reputation: 1123Reputation: 1123Reputation: 1123Reputation: 1123Reputation: 1123
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: 244

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: 244

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,513

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 01:19 AM.

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