PDA

View Full Version : Mount windows network drive from Linux


perfectpol7
26th August 2009, 12:30
I have Fedora 10 and Redhat Enterprise 5 which are my two servers, so I want to mount a windows folder on these linux machine but to no avail. my linux commands syntax are as follows:-
[root@cash ~]# mkdir /media/Windows_Share
[root@cash ~]# mount -t cifs -o username=perfectpol7,password=perfect**7,debug=4 //10.0.0.3 /media/Windows_Share
and I am getting this error message:

Mounting the DFS root for a particular server not implemented yet
No ip address specified and hostname not found

and if l change cifs with smbfs getting this error message

[root@cash ~]# mount -t smbfs -o username=perfectpol7,password=perfect**7,debug=4 //10.0.0.3 /media/Windows_Share
mount: unknown filesystem type 'smbfs'
my samba status is running
[root@cash ~]# /etc/init.d/smb status
smbd (pid 2583 2580) is running...
nmbd(pid 2584) is running...

The folder I want to map is shared from the windows and I can access it on all my linux servers that is through places -> network ->windows network ->then i double click the windows computer and access the folder.

now confuse as the smbfs is said to be unknown filesystem and cifs is not implemented yet how do i implement it.

bad_crow
26th August 2009, 13:54
Hi,

Indeed, linux is not able (to my knowledge at least) to mount a share without having the folder name.

Let's say your share is called "TestShare", you gave the ip which is 10.0.0.3.

You tried to mount 10.0.0.3 but you should try to mount 10.0.0.3/Testshare instead.

So you should use this //10.0.0.3/Testshare for the source.

Of course replace Testshare by the real name of the share when trying mount -t cifs, this should do.

perfectpol7
26th August 2009, 14:24
Thanks it works out! On more question is that i want this network map drive to mount when boot up.

bad_crow
26th August 2009, 14:32
You can launch a script at boot time using /etc/rc.local (from memory on debian at least).
So just create a script with the command including the password (which will be clear text in the file so do not let others see this file) and add sh /path/to/file into /etc/rc.local .

Another way to do it is to use /etc/fstab which mounts filesystems at boot up this may be cleaner than the script.

perfectpol7
26th August 2009, 14:51
Do i need to enter credential that is username and password in /etc/fstab

//10.0.0.3/User_data /media/Windows_Share username=perfectpol7,password=perfect**7, rw 0 0

bad_crow
26th August 2009, 15:16
yes, fstab use the mount command so you have to precise all you got into your command. if you don't precise username and password it won't mount because of a failed authentication or will be in guest mode if available.

I guess you can still link user and pass into a separated file but I don't know the option, maybe something like credential or credentials.

I haven't any access to an fstab to help you to fill it but by memory.

//10.0.0.3/User_data /media/Windows_share cifs usnername="xxx",password="yyy" 0 0

I think you forgot fstype into your last message.

So indeed they will appear in clear text in this file, but the protocol send them in clear over network too.

You may also be able to use a limited account dedicated for that.
gid / uid options can also be useful to set an owner.

perfectpol7
26th August 2009, 16:30
thanks for the support managed to automount it, l have enter the commands and the credentials and restart the server, the network map drive was mounted on startup

bad_crow
26th August 2009, 17:12
No problem, you're welcome.