How to mount windows share on linux system ad non-root user
Mount windows share on linux system easily.
Due to increased requirement of linux servers in production environment, some times there are needs to mount windows shares to linux systems. you can definately and certainly mount windows shares on Linux machines using smbmount. follow steps listed below to achieve it.
when you use this command, by default it does not allow the non-root users to write in this directory. only root user can mount shares using it. If you try to change the owner of the directory using chown command then it will throw error.
it will report an error ,such as "operation not permitted "
changing the permissions of the directory will not work either.
For this situation tricky solution is to add sticky bit on smbmnt. after then you will able to mount it as non root user.
chmod +s /usr/bin/smbmnt
and now try above mentioned command as non-root user.
smbmount //{Name ORIP of windows system}/{Share Name} {local path on linux to be mounted} -o username={username},password={password} rw
if you will setup sticky bit on smbmount then you will see following error.
You need to try again to mount the shared folder and it should work this time.
If you get an error like this in some Linux OS
"libsmb based programs must *NOT* be setuid root."
If you have already set the suid bit for /usr/bin/smbmount, then unset it as
chmod -s /usr/bin/smbmount
hope this helps.