Mounting Windows NT shared folders for individual users
I am using redhat 9.0 and suse 8.2. I am trying to mount windows NT shared folders on start up. I have four users. I used the following line on fstab.
//windowsNt/shared /linux/mount smbfs username=username,password=password 0 0 It works but it mounts the folders on start up for all users. I only want 2 of my users to be able to mount windows NT shared folders. Is there a fstab file for individual users, or any other way to mount shared folders for specified users?\ |
I'm assuming that you want to allow 2 linux users to be able to access the samba NTFS share. Look up in man mount. There are options listed for smb mounts. The option that you want to add is gid=xxx. Make a new group for that purpose of sharing the NTFS share, and make those two users members of that group. You can enter the group name instead of the gid number in the fstab entry. Remember to make the new group before you add the gid= option.
|
Did that, and it didn't work. But it's a neat feauture though.
What I want to acheive is to mount NT shared folders for 2 users only. For instance I have four users. user1, user2, user3, and user4. I want the shared folders to be mounted when user1 and user2 log in, but I dont want it to be mounted when user3,4 log in. What I thought I could do was to put them in .bash_profile or .bashrc of specific user, so they'd run everytime that user logged on. had no luck on that yet. I dont think that's possible anyway. A start-up file or something for individual users is pretty much what I had in mind. |
well i dont think that putting the mount command in the user .bashrc file would not work....It should if you give it the right options like:
. mount -t smbfs ......... put this somewhere in your .bashrc and i think it should work. bettre still you could put the entry in fstab and then just do a mount in .bashrc. play around with it...i am sure this would work...oh only if i had a windows network to test this out....but i am much more happy without one...:) |
yup...putting a script in .bashrc will work.i wrote this script:
Code:
#!/bin/bash and it works just fine...if the dev is already mounted then the error message will go to /dev/null else...it will mount this device. I havent figured out how to umount it when i log out but i guess you can look into that. hope this helped. |
That looks like a great idea, but I'm bot very familiar with linux scripting, so if
you could be a little more specific, that would be great. code: #!/bin/bash iam=`whoami` if [ $iam = rmanocha ];then mount /dev/hda3 2>/dev/null fi code: #!/bin/bash:::: I suppose thiz 2 lines just should be there? iam=`whoami` :::: I have no idea what this line does [ $iam = rmanocha ] :::same goes for this line. Assuming that I have 3 users. linuxuser1, linuxuser2 and linuxuser3. How would I mount windows nt shared folders for linuxuser1? eventhough I was trying to avoid fstab I put the following line in fstab just to see what would happen. //windowsNT/shared /shared smbfs username=username,password=password,noauto then I used the .bashrc to mount that folder for linuxuser1 code: #!/bin/bash iam=`whoami` if [ $iam = rmanocha ];then mount /shared 2>/dev/null fi no luck I couldn't even mount that from command prompt. I had to log on as root first. Please Advice. By the way I think u can unmount devices when u log out by using .bashlogout. |
Quote:
Quote:
Quote:
Quote:
Code:
if [ $iam = linuxuser1 || $iam = linuxuser2 || $iam = linuxuser3 ];then Quote:
Code:
//windowsNT/shared /shared smbfs username=username,password=password,noauto,user what you should have is this: Code:
#!/bin/bash hope this helps.let me know if it does. a good site to learn bash programming is here |
All times are GMT -5. The time now is 10:55 PM. |