LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 12-13-2007, 04:31 PM   #1
scoutert24
LQ Newbie
 
Registered: Dec 2007
Posts: 5

Rep: Reputation: 0
Problem with cisfs mount with /etc/fstab


I was not able to find any relevant posts / solutions that worked for my problem.

I am trying to mount a remote filesystem through fstab and I need to mount it under a specific user due to a software application limitation.

OS: RedHat EL 5
Kernel: 2.6.18-8 SMP

fstab entry:
Code:
//192.168.w.x/backups   /mnt/cr_tera cifs    auto,rw,user,password=,uid=504,gid=6    0 0
//192.168.y.z/backups   /mnt/cf_tera cifs    auto,rw,user,password=,uid=504,gid=6    0 0

Ownership / permissions on mounts:
[user@server mnt]# ls -l
drwxrwxrwx 2 root root 0 Dec 3 00:44 cf_tera
drwxrwxrwx 3 root root 0 Dec 13 08:44 cr_tera

Any help would be appreciated.

Thanks,
Robert
 
Old 12-13-2007, 05:01 PM   #2
Brian1
Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 61
Networking is not up at the time of running fstab file. I would change the auto to noauto in the fstab for the mount line and then add the mount command for the shares to run in /etc/rc.local. This is one of the last scripts to run.

Brian
 
Old 12-13-2007, 06:42 PM   #3
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
An alternative is to use the _netdev option in /etc/fstab. It will defer mounting a share until the network is up.

You could still use noauto, and manually mount them with the command "mount -a -o _netdev". This will mount entries with the _netdev option.

I don't know if you were obfuscating the password= entry. You need "username=<a_user_name>" and "password=<a_password>". It would be better to use a credentials file and refer to it in /etc/fstab. Otherwise anyone can read the password. The "user" option allows the user to mount the share. The "uid=" option will determine the ownership of the mounted share. This won't supply the "username=" entry however.

When a samba share is mounted, the mount.cifs program is what performs the mount. So you can put the samba fstab entries in
/etc/samba/smbfstab instead.
For example:
Code:
//fjall/test    /data/test      cifs    username=tridge,password=foobar
The ownership & permissions on the /mnt/cr_terra and /mnt/cf_terra directories will change after the filesystems are mounted on the directory.

Normally you need to add the windows user & password using "smbpasswd". This is unless you are using a PDC or AD or a database for authentication.

Look in /usr/share/doc/samba-<version>/ or /usr/share/doc/packages/samba/ for a number of howtos and 3 Samba 3 books.

---

By the way, you don't need to obscure a private IP address in your postings.

Last edited by jschiwal; 12-13-2007 at 06:44 PM.
 
Old 12-14-2007, 07:04 AM   #4
scoutert24
LQ Newbie
 
Registered: Dec 2007
Posts: 5

Original Poster
Rep: Reputation: 0
I'm sorry, I was as specific in my problem.

My problem is not with getting the mount to work, but with the ownership of the mount.

As you see in my fstab entry that I set the "uid" option, but everytime I mount it, it is owned by root and not the uid I specified.

Robert
 
Old 12-15-2007, 11:54 PM   #5
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
Was the share mounted? Do you see files under the mount point as root? By the way, you can use your username after uid=.
Did you also use smbpasswd to add your username as a samba user? Are the permissions on the directory being shared OK? In other words, would the user represented by 501 be allowed to read from the directory. I'm not certain, but that may prevent it from being mounted with the user being the owner of the mounted partition.

I've been running nfs instead of samba. I just fired up samba on my desktop and mounted the service on my laptop without seeing your problem.
 
Old 12-17-2007, 08:05 AM   #6
scoutert24
LQ Newbie
 
Registered: Dec 2007
Posts: 5

Original Poster
Rep: Reputation: 0
Yes, the share gets mounted, but under the root user. I did not use smbpasswd because the share does not require authentication (which is why I have a "password=" option to stop cifs from asking me for a blank password). Please let me know if you have further questions so I can get this mounted under the correct user.

Thanks for your help!
Bob
 
Old 12-17-2007, 08:45 AM   #7
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
I created a new user "testuser" so that I could try mounting my regular users profile/ on that computer.
Code:
 sudo mount -t cifs //hpmedia/profiles hpmedia/ -o ro,uid=testuser,credentials=/home/jschiwal/.credentials
This was successful. I also tried it with the rw option. I used the credentials file of the user owning the service. I hadn't added "testuser" with smbpasswd. The "jschiwal" user was already added.

The username of the files and directories in /home/testuser/hpmedia was "testuser".

What is the configuration of the "backups" services on the two servers. Who owns the directories?
Since root mounts these directories it should be save to have a credentials file for that user or users in /root/. Only the root user would have access to the file. The user with the "504" uid won't need to enter a password because the share is already mounted.

Last edited by jschiwal; 12-17-2007 at 09:01 AM.
 
Old 12-18-2007, 08:29 AM   #8
scoutert24
LQ Newbie
 
Registered: Dec 2007
Posts: 5

Original Poster
Rep: Reputation: 0
The "amandabackup" user owns the directories, currently I do not have a credentials file because the share I am mounting does not require authentication. I just tried it again and here are the results:

Code:
[root@nvadmin amanda_backups]# umount test/
[root@nvadmin amanda_backups]# mount -t cifs //192.168.2.6/backups test/ -o rw,u
id=amandabackup,password=
[root@nvadmin amanda_backups]# ls -l
total 0
drwxrwxrwx 2 root root 0 Dec  3 00:44 cf_tera
drwxrwxrwx 3 root root 0 Dec 13 08:44 cr_tera
drwxrwxrwx 3 root root 0 Dec 13 08:44 test
[root@nvadmin amanda_backups]#
Thanks for the help!
 
Old 01-02-2008, 06:12 AM   #9
scoutert24
LQ Newbie
 
Registered: Dec 2007
Posts: 5

Original Poster
Rep: Reputation: 0
I finally got it to mount under the specific user:

Code:
In fstab:
//192.168.3.1/backups   /amanda_backups/cf_tera cifs    auto,rw,user,password=,uid=504,gid=6    0 0
*Note the "user" option in the list of options
 
Old 04-22-2008, 09:58 AM   #10
lefty.crupps
Member
 
Registered: Apr 2005
Location: Minneap USA
Distribution: Debian, Mepis, Sidux
Posts: 470

Rep: Reputation: 32
Thank you for the "_netdev" tip, that is handy! Also, thank you for the comment on the /etc/hosts file, I was trying to mount a share with a name rather than an IP and this helped me to solve my problem.
 
Old 03-02-2009, 05:37 PM   #11
peacejp
LQ Newbie
 
Registered: Mar 2009
Posts: 1

Rep: Reputation: 0
problem with cifs mount

i have added entry in /etc/fstab
//x.x.x.x/netapps /usr/share cifs username=guest,password=,defaults 0 0

when i do mount -a
it mounts successfully but i looses my mount after i reboot.
I don't have username and password so i kept as guest.
If I don't give username and password it prompt and i have to press enter .
Can any one help on this??

Thanks in advance
 
  


Reply

Tags
cifs, mount, uid


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
fstab problem: mount: can't find dvd in /etc/fstab or /etc/mtab Nikon01 Slackware 5 11-17-2006 06:15 AM
FSTAB: My Win Share Wont Mount @ Boot, but will when I sudo mount -a...please help! TruANTOlogy Ubuntu 8 06-20-2006 08:00 AM
fstab problem mount partition as user? ethereal9 Linux - Newbie 5 01-01-2006 03:54 PM
mount --bind (fstab problem) renski Linux - General 2 11-17-2005 03:50 PM


All times are GMT -5. The time now is 04:07 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration