Linux - NewbieThis 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!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
As far as I am aware it is not possible without mentioning username and password in /etc/fstab or without using credential file. The reason being during startup it reads the /etc/fstab file and mount the partitions on the basis of it.
The processess cannot be halted to put in the password. The best you can do is to create a script which contains the command to mount samba share (just mention the username there not the password) and call that script via /etc/rc.local.
You can mount the share as read/write if in the backend you have specified that share is writable. This is something you need to do in Samba backend. If you have shared a directory via Samba as read only then you cannot write to it.
For the "Permission denied" error the syntax is a bit different. The one you mentioned is:
mount -t cifs //server/share /mountpoint -o rw,username=myuser
As I mentioned before if share access control is defined in backend. No need to mount it using -o rw. The correct syntax is:
mount -t cifs //server/share /mountpoint -o username=domain_name/myuser
mount -t cifs //server/share /mountpoint -o username=workgroup_name/myuser
When you are mounting the share you should specify the domain name or the workgroup name as described above.
Just a brief comment: Adding the mount to rc.local would, I believe, not be an effective way to get a "Password?" prompt, since rc.local is run, as "root," by the init script. I just use a .smb_credentials file in my $HOME directory. Since that's a hidden file, and I deny read to group and others, only I (or "root") can access the file.
I suspect that you may be resisting using a credentials file is because you suspect that it may compromise your security, but if nobody but you (and "root") can read the file, I don't think that there's much compromised. Even if someone reads the name in fstab, they will still not be able to read the file. (You'd use something like chmod go-rwx .smb_credentials command to set the file permissions so only you could access that file. See man chmod for details.)