PDA

View Full Version : [SOLVED] Mounting samba ntfs share with correct permissions



npaisnel
May 1st 2007, 08:58 AM
First of all, thanks to all those in the past couple of weeks who have helped me get the network sorted. I can now see, read, write to and from all machines on the network within Konqueror. Still not possible to do it from within software though.

That is what I need.

I can mount the share manually using
sudo mount -t smbfs //Su/My\ Pictures\ on\ Su /home/pics

If I right click inside the folder opened in Konqueror
smb://su/My Pictures on Su
I get the option of "Create new"

BUT if I do the same in the mounted folder in Konqueror
/home/pics
There is no option to "Create New".
Properties of all folders/ files are showing as Owner root root

Even when I can create a new item in the samba share I can't edit it. I can delete by selecting, right click and delete, but not be dragging to the Trash bin

Opening a terminal window in the local mount point directory gives these permissions.
neil@Feisty:/home/pics$ ls -l
total 25
drwxr-xr-x 1 root root 4096 2007-01-09 20:01 Card edits
drwxr-xr-x 1 root root 4096 2007-05-01 08:14 Neil
drwxr-xr-x 1 root root 4096 2007-01-05 21:35 Neils Old Pics till end 2006 Do Not modfy add or remove
drwxr-xr-x 1 root root 4096 2007-04-29 07:36 QuickCam
drwxr-xr-x 1 root root 4096 2007-04-27 11:57 Su
drwxr-xr-x 1 root root 4096 2007-04-27 09:15 Su's old Photos till end 2006
-rwxr-xr-x 1 root root 2 2007-05-01 09:47 testpermdoc
neil@Feisty:/home/pics$

Have tried mounting and changing the options, but cant get it correct permissions set so I can create/edit/write to the local folders.

Cant get the syntax correct in the mount command

Have also tried to do it automatically from fstab, but cant get the line formatted correctly in there either.

have looke through the man pages, but cant find the correct place to and the permission options

penguin.ch
May 1st 2007, 09:14 AM
sudo mount -t smbfs //Su/My\ Pictures\ on\ Su /home/pics


Maybe one of the following commands will do ...:



# sudo mount -t cifs -o uid=1000,gid=1000 '//Su/My\ Pictures\ on\ Su' '/home/pics'
# sudo mount -t cifs -o umask=000 '//Su/My\ Pictures\ on\ Su' '/home/pics'


(you may even try to combine the options ... ;)).

npaisnel
May 1st 2007, 09:43 AM
Great, thanks, that seemed to work.
Had not even tried any other options in the line except smbfs. I assumed that because it was a samba share, that I would have to use smbfs.

neil@Feisty:~$ sudo mount -t cifs -o uid=1000,gid=1000 //Su/My\ Pictures\ on\ Su /home/pics
Password:
Password:
neil@Feisty:~$ cd /home/pics
neil@Feisty:/home/pics$ ls -l
total 104
drwxrwxrwx 1 neil neil 0 2007-05-01 10:26 Card edits
drwxrwxrwx 1 neil neil 0 2007-05-01 08:14 Neil
drwxrwxrwx 1 neil neil 0 2007-01-05 21:35 Neils Old Pics till end 2006 Do Not modfy add or remove
drwxrwxrwx 1 neil neil 0 2007-04-29 07:36 QuickCam
-rw-r--r-- 1 neil neil 103936 2007-05-01 10:36 samba file shar permissions.doc
drwxrwxrwx 1 neil neil 0 2007-04-27 11:57 Su
drwxrwxrwx 1 neil neil 0 2007-04-27 09:15 Su's old Photos till end 2006
neil@Feisty:/home/pics$

I can now create and write, edit documents in the mounted shared folder, in Open Office, Kate. GIMP, but as you would expect, the one bit of software that I want to do this for (KPhotoAlbum) is still failing to create a database in that directory.

How would I alter the entry
sudo mount -t cifs -o umask=000 //Su/My\ Pictures\ on\ Su /home/pics

to work in the fstab file?

penguin.ch
May 1st 2007, 03:03 PM
I assumed that because it was a samba share, that I would have to use smbfs.


In short, Samba implements Mickeysoft's Common Internet File System (CIFS) protocol, the successor to Mickeysoft's Server Message Block (SMB) protocol - which is why they are "conditionally interchangeable" (nice term, isn't it ...).



How would I alter the entry [...] to work in the fstab file?




'//Su/My\ Pictures\ on\ Su' /home/pics cifs auto,umask=000 0 0


(Further reading: man mount (http://www.die.net/doc/linux/man/man8/mount.8.html), man mount.cifs (http://www.die.net/doc/linux/man/man8/mount.cifs.8.html))

npaisnel
May 1st 2007, 07:20 PM
OK, I see, so the options go at the end, rather than within the string.

I found when using the cifs command, the machine hung on shutdown, with a cifs server error, or something similar. I should have made more of a note of what it was.

On next reboot, I used
sudo mount -t smbfs -o uid=neil //Su/My\ Pictures\ on\ Su /home/pics
instead.
This seems to have worked, and I can now access the mounted share from within KPhotoAlbum.


Yes, "conditionally interchangeable" like that, definetly one to remember.

I had a quick look at those links while at work...Looks heavy going but I will have go later during the week.

Thanks

npaisnel
May 2nd 2007, 08:01 PM
Well I dont know how to do it

Read through the man pages articles and also:
http://www.justlinux.com/nhf/Filesystems/Mounting_smbfs_Shares_Permanently.html

But what ever I try always ends up with the same error message in the Konsole:

neil@Feisty:~$ sudo mount -a
[mntent]: warning: no final newline at the end of /etc/fstab
[mntent]: line 12 in /etc/fstab is bad

If I add the 0 0 that I see at the end of each line in the fstab file, I get an extra error of:
mount: mount point 0 does not exist.
I can see no mention of 0 0 in any of the docs, am I just blind?


From what I can see one article says the format should be like:
//servername/sharename /mountdirectory smbfs username=windowsuserename,password=windowspassword 0 0
when in the fstab file
but the man pages show a different format with the options in the middle of the string:
sudo mount -t smbfs -o uid=neil //Su/My\ Pictures\ on\ Su /home/pics.


When editing as root in Kate, the bit after
//Su/My\ Pictures\ on\ Su /home/pics smbfs

always ends up written in red text and underlined, so I am assuming that that is some sort of warning that the format is wrong. Even direct cutting and pasting of the lines in the articles, then substituting my data, does not work, still get the errors.

This line:
sudo mount -t smbfs -o uid=neil //Su/My\ Pictures\ on\ Su /home/pics

works perfectly from the konsole, but I just can't get it formatted correctly to go in the fstab file.

Can any one help this f*****G idiot get it correct before I get a big axe out and 'unmount' the whole linux box from the network completely :)

npaisnel
May 2nd 2007, 08:26 PM
Seem to have solved the way to get it in to the fstab file, but it does not run on startup.

Once the system has booted, I have to open a Konsole and do
sudo mount -a

then it mounts up

I found this article:
http://www.penguin.ch/dokuwiki/doku.php/debian:fstab#a_bad_joke
which says:
Some “improved” versions of Debian Linux (e.g. Kubuntu 06.10) effectively try to mount remote shares mentioned in the file system table before they bring up the network required to reach them ... “philosophical mounting” at it’s best :-P
To still achieve practical results, you have to restore the natural order of things (read: sequence of boot scripts), which is highly system-dependent - e.g. by:

ROOT # mv /etc/rcS.d/S40networking /etc/rcS.d/S29networking

Well, I tried that also, and the networking has now moved down to item 29 in the start up scripts, but it still does not mount the remote folder on startup.

Any better suggestions?

penguin.ch
May 3rd 2007, 06:12 AM
works perfectly from the konsole, but I just can't get it formatted correctly to go in the fstab file


Then show to me / us what you have at present - and we / I will help you on with the editions ;)

npaisnel
May 3rd 2007, 06:17 PM
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# /dev/sda1
UUID=a5f8b42d-3ef8-4976-b81f-c00e0bb99413 / ext3 defaults,errors=remount-ro 0 1
#
# /dev/sda5
UUID=8b2bf489-46ba-470f-870a-6c58c905330c none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
#
//Su/Pictures /home/pics smbfs -0,uid=neil,rw 0 0
#

That is the fstab file, with the last line being the relevant one for the share.

The Share folder on the windows machine was "My Pictures on Su" but I could not fine a way to input it in the fstab file without all the spaces in it causing problems. Tried the \ and % symbols but couild not get it to work. Easier to change the shared folder on the Windoze machine to simply Pictures. Now it can go in the fstab file without causing problems.

It works in the fstab file, but not on startup, I have to do:
sudo mount -a
to mount it after a restart.

I read
http://www.penguin.ch/dokuwiki/doku.php/debian:fstab#a_bad_joke
which advised moving the network start script in /etc/rcS.d/ from S40 to S29

# mv /etc/rcS.d/S40networking /etc/rcS.d/S29networking

But this has not helped, it still does not start on boot.

penguin.ch
May 3rd 2007, 07:46 PM
'/Su/Pictures /home/pics' smbfs -0,uid=neil,rw 0 0




'/Su/Pictures /home/pics' smbfs user,auto,rw,uid=1000,gid=1000,umask=000 0 0

npaisnel
May 3rd 2007, 08:33 PM
Nope, no different, still does not start on system boot, and I have to use
sudo mount -a

npaisnel
May 7th 2007, 02:47 PM
Changed the line in the fstab file to use cifs instead of smbfs
Now it starts on boot

penguin.ch
Jun 17th 2007, 06:28 PM
http://www.penguin.ch/dokuwiki/doku.php/debian:fstab#a_bad_joke


http://www.penguin.ch/dokuwiki/doku.php/buntu:k_0710:config#a_practical_joke

--

Postscript: reference updated