automatic mount SMB

Asked by asgujju

Hello Sir,
I'm newly in Kubuntu, i'm using Kubuntu 8.4...
I'm using SMB server for sharing media file, i mounted SMB server successfully in kubuntu.... But when i reboot my system server is not mounting automatically... find below FSTAB Configration.
//192.168.2.3/hyd /media/winshare smbfs iocharset-utf8,credentials=/etc/smbcredentials,dir_mode=0775,gid=1001 0 0

Please advice to me

Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
asgujju
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

if you run:

sudo mount -a

Does it then mount ok?

Revision history for this message
asgujju (asgujju) said :
#2

sudo mount -a command is working perfectly my all drive are mount. But after reboot my system it's not coming so i go to terminal and again run this command after it will come. Is there any solution for automatically mount?

Thanks

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

You can try this:

gksudo gedit /etc/rc.local

and add this line ABOVE the exit line

mount -a

Save the new file and close gedit, The fstab file is processed as soon as it can which is before the network comes up, causing the mount to fail. If you run the command after then it will mount so we add it to rc.local which is executed as root after everything else has passed.

Let us know how you get on.

Revision history for this message
asgujju (asgujju) said :
#4

i add line mount -a above exit line and save new file rc1.local... I reboot System but still not coming....

Thanks

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#5

You could make mount not need sudo then add the command as an entry in you startup items in system -> prefs -> startup

You will need to edit a VERY sensitive file to get mount to not need sudo but it can be done.

sudo cp /etc/sudoers /etc/sudoers_old; sudo nano /etc/sudoers

You will see this:

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root ALL=(ALL) ALL

# Uncomment to allow members of group sudo to not need a password
# (Note that later entries override this, so you might need to move
# it further down)
# %sudo ALL=NOPASSWD: ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

Make it say this:

# Host alias specification

# User alias specification

# Cmnd alias specification
Cmnd_Alias MOUNT_CMDS = /bin/mount, /bin/umount

# User privilege specification
root ALL=(ALL) ALL

# Uncomment to allow members of group sudo to not need a password
# (Note that later entries override this, so you might need to move
# it further down)
# %sudo ALL=NOPASSWD: ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
<your username here> ALL=(ALL) NOPASSWD: MOUNT_CMDS

The part that says <your username here> NEEDS CHANGING. For example if your username was andy it would be:

andy ALL=(ALL) NOPASSWD: MOUNT_CMDS

I say this because far too many people simply copy stuff without reading stuff so I cover my ass now.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#6

Having added that you can simply add a new startup entry that says:

sudo mount -a

There will be no password prompt for it and the mounts will succeed.

Revision history for this message
asgujju (asgujju) said :
#7

I change like below as u instruct me

# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#

Defaults env_reset

# Uncomment to allow members of group sudo to not need a password
# %sudo ALL=NOPASSWD: ALL

# Host alias specification

# User alias specification

# Cmnd alias specification
Cmnd_Alias MOUNT_CMDS=/bin/mount,/bin/umount

# User privilege specification
root ALL=(ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
tv9 ALL=(ALL) NOPASSWD: MOUNT_CMDS

---------------

Then i run command sudo mount -a
not ask me for password
good

But after reboot my system my drives are not mount automatically

Please refer my sudoers file.....

Thanks

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#8

You will need to play with that file some, if you do make the system not work you will need to boot to recovery root console and rename the original file back OR boot to live CD to copy the file back

You can consult this for better guidance. Personally I've never messed with this file and think it is a bad idea but it CAN be done:

https://wiki.ubuntu.com/RootSudo

Revision history for this message
asgujju (asgujju) said :
#9

sir i'm not talking about all my drives i'm just talking about SMB map drives is not coming automatically. My system is working fine.

Thanks

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#10

yes i understand that but if you add:

sudo mount -a

to your startup you will be bothered for a password each time

it will infact need to be:

gksudo mount -a

so you get a dialogue box for the password. Messing with /etc/sudoers can get rid of the requirement for the password entry for certain commands

Revision history for this message
asgujju (asgujju) said :
#11

Sir thanks for guide me..... finally i got solution. i make executable sudo mount -a file into Autostartup DIR and finally the got success.