Mount Windows Share for Users - Password Prompt

01grander

New Member
Joined
Apr 27, 2023
Messages
4
Reaction score
1
Credits
46
Not sure if this is the right area, sorry if I miscategorized this post.

I am pretty new to Linux, know very little, but trying to figure it out. I found that I could mount a windows drive by using these commands:

mkdir /home/username/Desktop/win_share

got uid and gid by typing ID in terminal

sudo mount -t cifs -o username=[email protected],uid=1145055445,gid=1145055445 //share.college.edu/data /home/username/Desktop/win_share

This works for people that are admins but gives a Sudoer error and doesn't mount for non-admins. What can I add to the Sudoers file to allow certain users to mount and umount this command?

Also, if anyone had suggestions, I'd ideally like this to run automatically, I know about fstab and autofs but these are windows domain users, I joined the RHEL 8 box to the AD domain for my university and we require regular password changes, I know you can write a cred file but I'd rather not have to help every user each time they changed their password, it would be nice if there was a way just to get a script to run with the command above and ask them for their password, I know it wouldn't be a persistent mount.
 


Look in the fstab man page, "man fstab".
user allow a user to mount
So add the "user" option to your fstab entry.
 
Look in the fstab man page, "man fstab".

So add the "user" option to your fstab entry.
Isn't the fstab function mainly about persistent mounts? I thought it was something that would survive a reboot, I don't want that since it probably won't play nice with AD and lock people out.

I may be mistaken though.
 
I thought you wanted persistent mounts why would you not want to mount network shares persistent so that they automatically mount again after a reboot? If not you can still add a line to fstab with that option and "noauto" meaning it wouldn't automatically mount on reboot
noauto do not mount when mount -a is given (e.g., at boot time)
And then the user can mount it themselves if you also add the "user" option but if you don't want that you can use autofs.
 
I thought you wanted persistent mounts why would you not want to mount network shares persistent so that they automatically mount again after a reboot? If not you can still add a line to fstab with that option and "noauto" meaning it wouldn't automatically mount on reboot

And then the user can mount it themselves if you also add the "user" option but if you don't want that you can use autofs.
These are windows AD accounts, I have it realm joined so if they change their password, if its auto, it likely would lock their accounts.

Do you know how to modify the sudoers file to allow running that command? Because if I use the fstab, even with the noauto function, it would use the same credentials file and lock them out or I'd need to manually modify their creds each time.
 
Hi,

you can create a small bash script for every user for example under /opt/mount_shares which is accessible for root (chmod 0700 /opt/mount_shares/doe.sh) and enable access for single user via sudoers file.

An other possible solution is to use gvfs-mount this works in userspace. I have used it on my vs2-free to mount the backup storage it works good.
 
Not sure if this is the right area, sorry if I miscategorized this post.

I am pretty new to Linux, know very little, but trying to figure it out. I found that I could mount a windows drive by using these commands:

mkdir /home/username/Desktop/win_share

got uid and gid by typing ID in terminal

sudo mount -t cifs -o username=[email protected],uid=1145055445,gid=1145055445 //share.college.edu/data /home/username/Desktop/win_share

This works for people that are admins but gives a Sudoer error and doesn't mount for non-admins. What can I add to the Sudoers file to allow certain users to mount and umount this command?

Also, if anyone had suggestions, I'd ideally like this to run automatically, I know about fstab and autofs but these are windows domain users, I joined the RHEL 8 box to the AD domain for my university and we require regular password changes, Besides that, for me this source https://paperap.com/free-papers/public-speaking/ worked perfectly because it helped me a lot with public speaking, it really worked well, because because I couldn't do public speaking because the app wasn't working well, I hope to solve this soon. I know you can write a cred file but I'd rather not have to help every user each time they changed their password, it would be nice if there was a way just to get a script to run with the command above and ask them for their password, I know it wouldn't be a persistent mount.
Hi,

you can create a small bash script for every user for example under /opt/mount_shares which is accessible for root (chmod 0700 /opt/mount_shares/doe.sh) and enable access for single user via sudoers file.

An other possible solution is to use gvfs-mount this works in userspace. I have used it on my vs2-free to mount the backup storage it works good.
Thanks, solution number two worked perfectly for me ;)
 

Members online


Top