• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Mount NT shares upon reboot in Linux?

robisc

Platinum Member
I have asked part of this question here before and have been unable to grasp the concept, I am real stupid I guess. So before someone says RTFM or go to the manpages and look or do a search, please know that I have done all these and I still can't figure this out so if you have time to read this and help me I would appreciate it if not then please don't bother with a negative reply.
If you have a suggestion please make the response easy for me and don't assume I know much about Linux as I am pretty much new to this OS.

Here goes:

I am trying to access a couple shares on an NT server on my local network. I am running Suse 7.3, I have used the following command from the terminal to mount the NT shares sucessfully.

smbmount //server/share /local/dir -o username=n***,password=p***,ip=192.168.0.2

After I mount this one I am typing another command in the console for the other share similar to the first one.

Now I have 1 question and seemingly 1 problem.

My question is how can I get these shares to stay mounted when I log on as user since I can only run this as root, and how can I get these shares to stay mounted when I reboot?

My problem is that when I access these files from konqueror it will sometimes hang up and I can't do anything unless I logout of the system and then back in, this is more prevalant when accessing MP3 files than it is with other types.
 
Try adding those lines to /etc/rc.d/rc.local (check your /etc for a link to it since it may not be there on SuSE).
 
monkey thanks for the reply, I do have an rc file in the path /etc/rc.d/rc it doesn't end with .local though, is that where I need to add the line?

here is what is the text in that file:

#! /bin/bash
#
# Copyright (c) 1996-2001 SuSE GmbH Nuernberg, Germany. All rights reserved.
#
# Author: Florian La Roche <florian@suse.de> 1996
# Werner Fink <werner@suse.de> 1994-99,2000-2001
#
# /etc/init.d/rc -- The Master Resource Control Script
#
# This file is responsible for starting/stopping services
# when the runlevel changes. If the action for a particular
# feature in the new run-level is the same as the action in
# the previous run-level, this script will neither start nor
# stop that feature.
#

#
# On previous runlevel identical with current runlevel do not
# re-examine current runlevel.
#
test "$PREVLEVEL" = "$RUNLEVEL" && exit 0

#
# Comming from runlevel 1 we do not need to enter S
#
test "$PREVLEVEL" = "1" -a "$RUNLEVEL" = "S" && exit 0

#
# Avoid being interrupted by child or keyboard
#
trap "echo" SIGINT SIGSEGV SIGQUIT
trap 'test "$RUNLEVEL" = "1" && exit 0' SIGTERM
set +e

#
# Get terminal size of standard input of the system console
#
test -z "$CONSOLE" && CONSOLE=/dev/console
set -- $(stty size < $CONSOLE)
LINES=$1
COLUMNS=$2
export LINES COLUMNS CONSOLE

#
# Set I/O of this script and its childs to console
#
exec 0<> $CONSOLE 1>&0 2>&0

#
# This redirects all rc messages during reboot and halt
# to tty1 if the system console is bound on VGA (tty0).
#
REDIRECT="`showconsole 2>/dev/null`"
if test $COLUMNS -gt 0 ; then
# VGA
if test "$RUNLEVEL" = "0" -o "$RUNLEVEL" = "6" ; then
case "$REDIRECT" in /dev/tty[1-9]*)
export REDIRECT=/dev/tty1
setconsole $REDIRECT < $CONSOLE
set -- $(stty size < $REDIRECT)
LINES=$1
COLUMNS=$2
export LINES COLUMNS
esac
fi
else
# Serial: columns and lines are not defined
LINES=24
COLUMNS=80
test "$TERM" = "linux" -o -z "$TERM" && TERM=vt102
fi

#
# Configuration and coloring of the boot messages
#

. /etc/rc.status
. /etc/rc.config

#
# Save old terminal settings and set -nl to avoid staircase
# effect, do not lock scrolling, and avoid break characters.
#
otty=$(stty -g)
stty -nl -ixon ignbrk -brkint 0>&1

#
# Start blogd if not in single user mode
#
if test "$RUNLEVEL" != "S" -a -x /sbin/blogd ; then
/sbin/blogd $REDIRECT
fi

echo -n "Master Resource Control: "
echo -n "previous runlevel: $PREVLEVEL, "
echo -e "switching to runlevel: ${stat}${extd}${RUNLEVEL}${norm}"

runrc=/etc/init.d/rc${RUNLEVEL}.d
prerc=/etc/init.d/rc${PREVLEVEL}.d
rex="[0-9][0-9]"
failed=""
skipped=""

#
# First check and test services of previous and current (new) runlevel.
#
for i in $prerc/K${rex}*; do
test -x "$i" || continue

#
# Don't stop service if the new runlevel requires the service.
#
service=${i#*/K$rex}
set -- $runrc/S$rex$service
test $# -gt 1 && echo -e "$attn$runrc/: more than one link for service $service$norm"
test -x "$1" && continue

# send information to splash icon viewer.
rc_splash "$i stop"

# Log to /var/log/boot.msg
blogger "$i stop"

# Stop the services of the previous runlevel if they are missed
# within the current (new) runlevel.

$i stop; status=$?
case $status in
[1-4]) failed="${failed} ${service}" ;;
[56]) skipped="${skipped} ${service}" ;;
[07]|*) ;;
esac
echo -en "$rc_reset"

# Log to /var/log/boot.msg
blogger "'$i stop' exits with status $status"
done

for i in $runrc/S${rex}*; do
test -x "$i" || continue

#
# Don't start service if previous runlevel includes the service.
#
service=${i#*/S$rex}
set -- $prerc/K$rex$service
test $# -gt 1 && echo -e "$attn$prerc/: more than one link for service $service$norm"
test -x "$1" && continue

# send information to splash icon viewer.
rc_splash "$i start"

# Log to /var/log/boot.msg
blogger "$i start"

# Start the services of the current (new) runlevel if they are missed
# within the previous runlevel.

$i start; status=$?
case $status in
[1-47]) failed="${failed} ${service}" ;;
[56]) skipped="${skipped} ${service}" ;;
0|*) ;;
esac
echo -en "$rc_reset"

# Log to /var/log/boot.msg
blogger "'$i start' exits with status $status"
done

#
# Inform the users
# Reaction on LSB return values:
# OK : 0 - success
# FAIL : 1 - generic or unspecified error
# FAIL : 2 - invalid or excess argument(s)
# FAIL : 3 - unimplemented feature (e.g. "reload")
# FAIL : 4 - insufficient privilege
# SKIP : 5 - program is not installed
# SKIP : 6 - program is not configured
# FAIL : 7 - program is not running (doing "start")
# OK : 7 - program is not running (doing "stop")
#

rc_splash "master"

echo -n "Master Resource Control: "
echo -e "runlevel ${RUNLEVEL} has been ${stat}${extd}reached${norm}"
if test -n "$failed" ; then
n=$((${#failed} + 7))
echo -n "Failed services in runlevel ${RUNLEVEL}: "
test $n -lt 47 && echo -en "\033[${COLUMNS}C\033[${n}D"
echo -e "${warn}${failed}${norm}"
fi
if test -n "$skipped" ; then
n=$((${#skipped} + 7))
echo -n "Skipped services in runlevel ${RUNLEVEL}: "
test $n -lt 47 && echo -en "\033[${COLUMNS}C\033[${n}D"
echo -e "${attn}${skipped}${norm}"
fi

#
# Stop blogd if running
#
killproc -QUIT /sbin/blogd

#
# Restore old terminal settings
#
stty $otty 0>&1

#
# For the first logon on a virtual console.
#
test -e /etc/issue-SuSE-first-run && {
cat /etc/issue-SuSE-first-run > $REDIRECT
rm -f /etc/issue-SuSE-first-run 2>/dev/null
}

exit 0
 
You could add the following line to your rc file below:
'/sbin/mount -a -t smbfs'
Add the following line to /etc/fstab:
//server/share /mnt/mount smbfs defaults,username=????, password=???? 0 0

Hope it helps.
 
You're really not supposed to edit rc, that's why most distros come with an rc.local.

Using /etc/fstab like BlackOmen says is probably your best bet.
 
You're really not supposed to edit rc...
Meh, it would not be a problem if most distro's rc's (esp. Mandrake) could be read without splitting one's head open 😉

...that's why most distros come with an rc.local.
robisc said that he did not have an rc.local. So I guess the best approach would be to add '/etc/init.d/rc.local' and then create rc.local with my line from before.

Offtopic: Granted the rc file posted from Suse is quite easily followed, some aren't.
 
Meh, it would not be a problem if most distro's rc's (esp. Mandrake) could be read without splitting one's head open

Also if you install an update that includes a new version of rc it'll more than likely overwrite it and lose your changes.
 
I looked on my Debian system the other day, and couldnt find an rc.local. I guess it wouldnt be too hard to add one, but again you lose the quick changes when you update. mmm bsd rc... 😉
 


<< n0cmonkey posted:
mmm bsd rc...

mmm slackware (w/ bsd rc)
>>



Slack's rc looked a little scary when I took a look at it. Its not quite the BSD rc that Im used to. But its definitely not as bad as the sys v init of other distros. I tried to do something simple with my Debian box and it took me atleast 10 minutes to get everything working properly 😛
 
BSD init always bothered me, I find SysV to be easier to work with.

Debian gives you a skeleton script in /etc/rc.d to edit for new services, and if I ever wanted someting like rc.local I'd just create a custom script in /etc/rc.d with the rest of them.
 


<< BSD init always bothered me, I find SysV to be easier to work with. >>



Its not just a way to start the system, its a way of life 😛



<< Debian gives you a skeleton script in /etc/rc.d to edit for new services, and if I ever wanted someting like rc.local I'd just create a custom script in /etc/rc.d with the rest of them. >>



I managed to get everything working, and my biggest problem was my typing, not the way it was setup. Its also not what Im used to, so thats why it was a problem at all.
 
Its not just a way to start the system, its a way of life

So is being gay, I'm not subscribed to either =)
 


<< Its not just a way to start the system, its a way of life

So is being gay, I'm not subscribed to either =)
>>



Ouch. Not that there is anything wrong with that. Wasnt one of the sendmail coders gay?
 
OK I added:

smbmount //server/share /local/dir -o username=n***,password=p***,ip=192.168.0.2

to /etc/rc.d/rc

I rebooted and there was nothing mounted.

Next I added:

/sbin/mount -a -t smbfs

to /etc/rc.d/rc

and added:

//server/share /local/dir -o username=n***,password=p***,ip=192.168.0.2

to /etc/fstab

didn't work either, any more suggestions?
 
how about this... in proper format for fstab

//server/share /mnt/point smbfs username=xxxxx,password=xxxxx 0 0
This is the syntax of the entries in my file... although if this doesn't make it read-write you'll have to look for the syntax of it... I don't generally do that so I don't know off hand.

I don't know how BSD runs, but there is no need to put a mount -a in any startus script in linux (or any UNIX i HAVE dealt with), that's what the fstab (or mnttab) file is for.

You run the mount -a to cause a re-read of the /etc/fstab file and mount any filesystems that aren't mounted at the present time.
 
I don't know exactly what the proper format would be for this in fstab, I have done quite a bit of research and haven't come up with anything definitive but everything that I have tried that looks correct doesn't work. I have no NT shares mapped when I reboot, even after I mount them manually from the command line with the following:

smbmount //server/share /local/dir -o username=n***,password=p***,ip=192.168.0.2

Don't know what else to try. This should be easy I would think, I just need someway to automatically run this command at bootup. I can easily so it within Windows or even with BeOS by adding the command to bootscript.
 
/etc/rc2.d/S99GottaHaveIt
-----------------------------------------------------------------------------------------------------
#!/bin/sh


smbmount //server/share /local/dir -o username=n***,password=p***,ip=192.168.0.2 1>/dev/null&2>/dev/null


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

You tried this already right?



<< I can easily so it within Windows or even with BeOS by adding the command to bootscript. >>



I look forward to seeing your code to make it that easy in Linux.
 
I don't know exactly what the proper format would be for this in fstab

FUBAR posted the correct syntax.

//server/share /mnt/point smbfs username=xxxxx,password=xxxxx 0 0
 
Back
Top