lumi
Posts: 31
Joined: Sat Jul 14, 2012 12:19 am

how do i start samba at bootup

Wed Jul 18, 2012 12:04 am

how do i achieve samba starting at boot.

ive eventually managed to config it and its pointing to a share on a sep partition, however if i reboot the pi it stops working. My win 7 machine fails to connect untill i go and login into rpi and login to X then all is fine untill a reboot than i have to login all over again.

many thanks

lumi
Posts: 31
Joined: Sat Jul 14, 2012 12:19 am

Re: how do i start samba at bootup

Wed Jul 18, 2012 12:40 am

i used this guide http://elinux.org/R-Pi_NAS#Connect_the_RPi_to_a_network
but have set a public share to a folder in a sep partition and it is this that only works after i login to x on the rpi

AlvaroFG
Posts: 6
Joined: Sat Jul 14, 2012 3:55 pm

Re: how do i start samba at bootup

Fri Jul 20, 2012 12:58 am

mmm I would also like to know this, as an ex-DOS user I find myself looking for the autoexec.bat of linux :lol:

Jon_L
Posts: 3
Joined: Mon Jul 23, 2012 1:39 pm

Re: how do i start samba at bootup

Mon Jul 23, 2012 1:54 pm

Hi

"sudo apt-get install samba"

google raspberry.pi install samba there are loads of guides

tip - if you are the only person using the share don't bother with security as it is a minefield

make sure that you change the directory and file options to 775 (rwx,rwx,rx) and it should look just like a windows share

Jon

kgthatsme
Posts: 2
Joined: Sun Sep 09, 2012 11:50 am

Re: how do i start samba at bootup

Sun Sep 09, 2012 11:55 am

Hi I have this exact same problem! Sometimes I feel it's two steps forward and two back on linux!

bbncomms
Posts: 16
Joined: Tue Jun 26, 2012 2:43 pm

Re: how do i start samba at bootup

Wed Sep 12, 2012 11:39 am

I recently spent a period of time comparing the Pi with the BeagleBone and suggest you have a look @ http://www.gigamegablog.com/2012/01/29/ ... rom-linux/ .

Obviously not the Pi but the SAMBA bits are virtually the same (apart from the opkg as against apt-get etc) plus the static IP bit is also probably close - but not for today's Angstrom BeagleBone installation which is completely different. The main factor here is that SWAT is used to set up Samba which is certainly a help if you are not familiar with it etc. - thanks to the author D Watts!

Personally, it enabled me to get things up and running the way I want - a headless unit with remote network access to everything on the Pi (so far anyway) without any security problems (after setting up Pi's root password, I used this for remote access, used a '\' the path + made the last entry group in smb.conf look look like path = /, create mask = 0666, directory mask = 0775, read only = no) .
Plus implementing this on my Pi always boots Samba @ startup!

Probably not 'elegant' etc. but it worked for me.

kgthatsme
Posts: 2
Joined: Sun Sep 09, 2012 11:50 am

Re: how do i start samba at bootup

Wed Sep 12, 2012 11:09 pm

I haven't found 'the' solution but a workaround that worked for me was to map the network drive (when it's visible of course) and then this virtual local drive can be accessed without startx'ing.

This workaround also helped me easily sync with network folders (using Unison). I think it is much harder when it's just a 'network' location as you have to also use a SSH client to connect whereas a 'local' drive can just be browsed for.

plastygrove
Posts: 5
Joined: Sun Oct 14, 2012 5:12 am

Re: how do i start samba at bootup

Sun Oct 14, 2012 5:24 am

Here's what worked for me:
  1. Create a new file called 'samba' in /etc/network/if-up.d
  2. [code]sudo nano /etc/network/if-up.d/samba[/code]
  3. Copy the following code in the file. This script checks to see if samba is not running, then start it else do nothing
  4. [code]# Really only necessary to do anything if nmbd is not already running status=$(/etc/init.d/samba status) echo $status if ! echo "$status" | grep -q 'smbd is running' \ && ! echo "$status" | grep -q 'nmbd is running' then /etc/init.d/samba start fi exit 0 [/code]
  5. Save the file using Ctrl+O and exit using Ctrl+X
  6. Make the file executable:

    Code: Select all

    sudo chmod +x /etc/network/if-up.d/samba
  7. And we're done! This effectively creates a script that runs everytime the network is started. Reboot PI to test:

    Code: Select all

    sudo reboot

uritziel
Posts: 2
Joined: Wed Apr 06, 2016 12:00 pm

Re: how do i start samba at bootup

Wed Apr 06, 2016 12:02 pm

plastygrove wrote:Here's what worked for me:
  1. Create a new file called 'samba' in /etc/network/if-up.d
  2. [code]sudo nano /etc/network/if-up.d/samba[/code]
  3. Copy the following code in the file. This script checks to see if samba is not running, then start it else do nothing
  4. [code]# Really only necessary to do anything if nmbd is not already running status=$(/etc/init.d/samba status) echo $status if ! echo "$status" | grep -q 'smbd is running' \ && ! echo "$status" | grep -q 'nmbd is running' then /etc/init.d/samba start fi exit 0 [/code]
  5. Save the file using Ctrl+O and exit using Ctrl+X
  6. Make the file executable:

    Code: Select all

    sudo chmod +x /etc/network/if-up.d/samba
  7. And we're done! This effectively creates a script that runs everytime the network is started. Reboot PI to test:

    Code: Select all

    sudo reboot
This script broke my raspberry-pi, it's not booting anymore.. Any idea how to make it boot again?

mjf55
Posts: 7
Joined: Tue Jun 02, 2015 9:51 pm

Re: how do i start samba at bootup

Thu Apr 07, 2016 12:51 am

uritziel wrote: This script broke my raspberry-pi, it's not booting anymore.. Any idea how to make it boot again?
So if following the steps outlined in your post made your pi not boot, simply remove the file you created ( /etc/network/if-up.d/samba ) and reboot

Code: Select all

sudo rm /etc/network/if-up.d/samba
sudo reboot -i 

uritziel
Posts: 2
Joined: Wed Apr 06, 2016 12:00 pm

Re: how do i start samba at bootup

Thu Apr 07, 2016 11:04 am

mjf55 wrote:
uritziel wrote: This script broke my raspberry-pi, it's not booting anymore.. Any idea how to make it boot again?
So if following the steps outlined in your post made your pi not boot, simply remove the file you created ( /etc/network/if-up.d/samba ) and reboot

Code: Select all

sudo rm /etc/network/if-up.d/samba
sudo reboot -i 
How can you delete the script if you can't SSH into the pi?

DirkS
Posts: 9902
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: how do i start samba at bootup

Thu Apr 07, 2016 11:10 am

uritziel wrote:
mjf55 wrote:
uritziel wrote: This script broke my raspberry-pi, it's not booting anymore.. Any idea how to make it boot again?
So if following the steps outlined in your post made your pi not boot, simply remove the file you created ( /etc/network/if-up.d/samba ) and reboot

Code: Select all

sudo rm /etc/network/if-up.d/samba
sudo reboot -i 
How can you delete the script if you can't SSH into the pi?
Use the method described at http://www.raspberrypi-spy.co.uk/2014/0 ... -password/ to get to an 'emergency' shell.
From there you should be able to remove the file

Return to “Beginners”