Make Windows Share Available Via Login Script

There is a windows share setup that allows access via an smbclient. This share is automatically mounted as the Z:\ drive when windows logs on (in a login script). When logged in on an openSuSE Linux machine, that is also on the windows domain, I can use the network servers program to “browse” to the windows share without providing credentials. I would like a command to put this on a user’s desktop when they login.

I would like to include a script for a user logon to automatically “mount” this windows share using the users login credentials. I am not quite sure how to do this as the mount command is a privileged command by default. Also, the shares are set up security-wise which should transcend to the linux logins to the domain (via samba).

I know in windows there is a login script that does a “net use z: \share_server\share_name” which automatically mounts the share when we login to our windows machine. Is there something similar that can be run in a .bashrc script, or possibly another, where the share would be available to access without the root user mounting the share?

You can arrange for the share to be automounted whenever someone boots the computer and to be readable and writeable by anybody who uses the computer. It’s called a “cifs mount” in Linux, or in windows jargon it’s a “mapped drive”. Is that what you want?

I have considered the CIFS mount. The only problem I see with that is that permissions are all set up on the file server for our domain users. We also have our Linux machine to authenticate against our AD. If I were to mount the share, does this have to be done with root? If so, how do I use the credentials of logged on users to our domain to give them the correct access to shares on the file server. I also do not want to use a “credentials” file in each user’s home directory as this would potentially allow others to see the password. Even if I change the permissions of the file to 600, the root user would still be able to easily read the file in plain text, and this is also very undesirable.

Using the Gnome GUI, I can use the browse network servers and make a link to the share on my desktop. However, it does not show up if I do an “ls ~/Desktop”. With the ability to access this share via the GUI, I’m thinking there has to be some way to get this same feature via some commands in a login script.