View Full Version : [ubuntu] Make samba start up on machine reboot

July 2nd, 2009, 05:26 PM
When I reboot my Ubuntu box it doesnt start up the samba shares automatically - I have to manually start samba once the machine has finished booting up.

How would I go about creating a script or something that did
etc/init.d/samba start
as part of the start up process?

July 2nd, 2009, 07:20 PM
Try this site: http://www.debianhelp.co.uk/initscripts.htm

July 2nd, 2009, 07:24 PM
It should be set up to automatically start on reboot upon install. If it's not, the only thing I can think of is that it's been manually disabled in system > administration > services ... that, or there's something wrong with your smb.conf file.

July 5th, 2009, 11:37 AM
well I've had a look, but I'm no closer to sorting it.

When I reboot the machine, samba isnt in the
"system > administration > services"

I can't see anything in the samba conf file to indicate that it shouldnt start up on boot, and the conf file in general seems ok as all my shares are working as configured (after I start samba manually...).

Is there just a way of adding a .sh script to be run on start up, that will issue the /etc/init.d/samba start command?

I had a look at the debian link and tried the rcconf but couldnt figure it out. update-rc.d man is a little beyond me... not entirely sure how to do it with this method and don't want to break something...

Thanks guys.

July 5th, 2009, 03:12 PM
This was pulled right from the site I linked you to:

update-rc.d samba defaults

July 6th, 2009, 01:14 PM
Apologies. However, it just tells me a system startup link for samba already exists.


July 6th, 2009, 02:06 PM
Have you tried to run the start up script manually and see if it gives you any errors?

July 6th, 2009, 02:24 PM
Thanks for the replies.

I wasnt sure how to do what you suggested and couldnt see any clues when searching, so I made a guess and did:

sudo ./rc 2

It seems to be the start up script, although after almost every line of execution it outputs Permission Denied or Operation not permitted.

July 6th, 2009, 03:27 PM
lets try sudo /etc/init.d/samba start

July 6th, 2009, 03:39 PM

That one works fine. What led me to post here was that I was frustrated by always having to type that command when I restart my machine, in order to get the samba filesharing back up and running.

So yeah. Thats what I've been doing to get samba started after each reboot.

July 6th, 2009, 03:51 PM
Well only thing left I can think of is to remove it from the default runlevels and then try to reinstall it into them. A long shot but really the last thing I can think of.

sudo update-rc.d -f samba remove

July 6th, 2009, 04:07 PM
ok, well no luck with that one.

Thanks for your help though.

How would I add my own start up script to automate it?

I tried putting

/etc/init.d/samba start

in to myscript.sh

And then did

update-rc.d myscript.sh defaults

Am I barking up the wrong tree? Because that doesnt seem to work either!

July 6th, 2009, 05:02 PM
You would also have to make the script executable chmod +x filename but yes it should work.

December 1st, 2009, 03:53 AM
I have been having a similar issues with 9.10. Samba would actually start and then after a min or two would stop. I was able to see this by downloading the Service Manager below since 9.10 version of Ubuntu does not come with it anymore.

So I strangely enough I got this fixed by stopping Samba & Winbind. For some strange reason I'm still able to use the shared folders and Windows boxes on the network can see ping the hostname. I have no clue if CUPS is doing the job or another processes. Unfortunately I'm still learning the Linux world....

December 7th, 2009, 07:30 PM
known bug in 9.1

Not sure if there's a fix yet for it.

Other then never turn off the computer. Hey that's my fix and it's working!

December 10th, 2009, 04:04 PM
Very Funny, Love that commercial!

January 13th, 2010, 08:05 AM
The samba package has finally been fixed in karmic-updates;


ensure you have "karmic-updates" enabled in your /etc/init.d/sources.list , and do an apt update and upgrade.

Don't forget to remove the workaround detailed earlier if you were using it :)

January 13th, 2010, 06:59 PM
ZI cant even find this version 3.4 and even nmbd and there is nothing in the /etc/init.d/sources.list ! Totally confused about all of this.In package manager there is only versions and 4.0.