LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Mounting an smbfs using fstab (https://www.linuxquestions.org/questions/linux-newbie-8/mounting-an-smbfs-using-fstab-461202/)

RAdams 07-05-2006 09:41 AM

Mounting an smbfs using fstab
 
I'm trying to get a samba share to mount at startup. Here's my fstab entry:
Code:

//server/directory /mnt/sambashare smbfs credentials=/etc/samba/cred-file,uid=ronadams,gid=users,fmask=0770,dmask=0770 0 0
Here's my cred-file:
Code:

username right_username
password right_password

When I:
Code:

sudo mount -a
I get a prompt for a password, even if I've already run sudo just before. Entering my username password, the correct password for the share, and server/password (substituting the appropriate information) does nothing but get me:
Code:

6744: session setup failed: ERRDOS - ERRnoaccess (Access denied.)
SMB connection failed

Mounting using terminal commands to this directory works fine, as does using GNOME's network browser to get to it.

Any ideas?

Tinkster 07-05-2006 05:25 PM

I'd suggest adding a 'users' entry to the mount options, and
give the sudo-bit a miss. See whether a manual
mount /mnt/sambashare
works after that.


Cheers,
Tink

RAdams 07-06-2006 01:28 AM

Quote:

Originally Posted by Tinkster
I'd suggest adding a 'users' entry to the mount options, and
give the sudo-bit a miss. See whether a manual
mount /mnt/sambashare
works after that.


Cheers,
Tink

What users entry should I add?

I have to sudo, to mount anything in the /mnt folder, unless this 'users' entry you speak of fixes that as well...

Nylex 07-06-2006 01:31 AM

Quote:

Originally Posted by RAdams
What users entry should I add?

He means to literally add the word "users" to the options list of the relevant line in your fstab.

binary_y2k2 07-06-2006 02:16 AM

This sis what you want in your fstab
Code:

//server/directory /mnt/sambashare smbfs user,credentials=/etc/samba/cred-file,uid=rondams,gid=users,fmask=0770,dmask=0770 0 0

Tinkster 07-06-2006 02:51 AM

I actually said and meant users, because that way anyone can mount
and unmount, while with user only the person who mounted it can unmount it
again (and root, of course).


Cheers,
Tink

RAdams 07-07-2006 08:44 AM

Quote:

Originally Posted by Tinkster
I actually said and meant users, because that way anyone can mount
and unmount, while with user only the person who mounted it can unmount it
again (and root, of course).


Cheers,
Tink

I used "users" as you suggested. It still isn't working. I'm thinking maybe my cred-file is incorrectly set up, but I'm not sure. Refer to above. (Yes, I am certain the username and password are correct.)

Some terminal output that might prove helpful:
Code:

ronadams@Foucalt:~$ sudo smbmount //wecco_serv/F_Drive /mnt/fdrive smbfs credentials=/etc/samba/cred-file,uid=ronadams,gid=users 0 0
Password:
6771: session setup failed: ERRDOS - ERRnoaccess (Access denied.)
SMB connection failed
ronadams@Foucalt:~$ sudo mount -a
Password:
6777: session setup failed: ERRDOS - ERRnoaccess (Access denied.)
SMB connection failed
ronadams@Foucalt:~$


binary_y2k2 07-08-2006 02:08 AM

the command you want is:
Code:

sudo mount -t smbfs //wecco_serv/F_Drive /mnt/fdrive smbfs -o credentials=/etc/samba/cred-file,uid=ronadams,gid=users
You missed out the "-o" and you don't need "0 0" if mounting at the command line. Also it's best to run "mount -t smbfs" rather than smbmount
Quote:

Originally Posted by smbfs
This command is designed to be run from within /bin/mount by giving the option '-t smbfs'.


RAdams 07-09-2006 11:23 AM

Quote:

Originally Posted by binary_y2k2
the command you want is:
Code:

sudo mount -t smbfs //wecco_serv/F_Drive /mnt/fdrive smbfs -o credentials=/etc/samba/cred-file,uid=ronadams,gid=users
You missed out the "-o" and you don't need "0 0" if mounting at the command line. Also it's best to run "mount -t smbfs" rather than smbmount

What fstab entry is correct?

theNbomr 07-09-2006 12:19 PM

My samba credentials file is formatted like
Code:

username=myUserName
password=myPassword

note the '=' on each line.

A bit of a long shot, but worth a shot.

--- rod.

theNbomr 07-09-2006 12:29 PM

It's not clear to me that you are entering the right password at the right prompt. You do understand that each time you run sudo, you will need to enter a password (if it is configured to require a password, at all). So running
Code:

sudo mount -a
may require you to enter two passwords: one for sudo, and one for smbmount (actually a username + password).

I just want to clarify that you understand this concept.

In a similar vein, what happens if you run
Code:

mount -a
as root (not sudo)?

--- rod.

binary_y2k2 07-10-2006 02:11 AM

in fstab put
Code:

//wecco_serv/F_Drive /mnt/fdrive smbfs credentials=/etc/samba/cred-file,uid=ronadams,gid=users 0 0
and to mount at the command line
Code:

sudo mount -t smbfs //wecco_serv/F_Drive /mnt/fdrive -o credentials=/etc/samba/cred-file,uid=ronadams,gid=users
You'll need to enter your linux password once for sudo. If you are asked for a username and/or password after than then you need to look at your credentials file.
Quote:

Originally Posted by theNbomr
In a similar vein, what happens if you run
Code:

mount -a
as root (not sudo)?

Ubuntu has the root user disabled by default, so you can't su to root etc. To get a root shell you have to do
Code:

sudo -i

RAdams 07-10-2006 01:24 PM

Quote:

Originally Posted by binary_y2k2
in fstab put
Code:

//wecco_serv/F_Drive /mnt/fdrive smbfs credentials=/etc/samba/cred-file,uid=ronadams,gid=users 0 0
and to mount at the command line
Code:

sudo mount -t smbfs //wecco_serv/F_Drive /mnt/fdrive -o credentials=/etc/samba/cred-file,uid=ronadams,gid=users
You'll need to enter your linux password once for sudo. If you are asked for a username and/or password after than then you need to look at your credentials file.

Ubuntu has the root user disabled by default, so you can't su to root etc. To get a root shell you have to do
Code:

sudo -i

Thank you, thank you. That worked wonderfully. I also incorporated the "username=foo" instead of "username foo" suggestion; I'm not sure if that helped or not (it certainly didn't hurt!). I'll test that later.

PS: Regarding logging in as root, one of the first things I do with any new Ubuntu install is
Code:

sudo passwd root
to allow root login. ;]

Cheers!

binary_y2k2 07-10-2006 01:55 PM

I'm glad you got it to work
For the credentials file the man page says its in the format
username = <value>
password = <value>
(with spaces) but I guess it's a bit forgiving.
I know about "sudo passwd root" (was also the 1st thing I did) but not all users will have it so that's why i gave the sugestion "sudo -i" works well, you could even do "sudo bash"

RAdams 07-11-2006 12:20 AM

Quote:

Originally Posted by binary_y2k2
I'm glad you got it to work
For the credentials file the man page says its in the format
username = <value>
password = <value>
(with spaces) but I guess it's a bit forgiving.

Ah. Well, I suppose I better maintain the standards then... ;]

Quote:

I know about "sudo passwd root" (was also the 1st thing I did) but not all users will have it so that's why i gave the sugestion "sudo -i" works well, you could even do "sudo bash"
Gotcha.


All times are GMT -5. The time now is 01:40 PM.