Samba Configuration (and FTP)

Post Reply
FireAngel
Posts: 4
Joined: Sat Jun 18, 2011 12:19 pm

Samba Configuration (and FTP)

Post by FireAngel » Sat Jun 18, 2011 12:28 pm

Hello everybody,

I recently obtained SSH root access on my LaCie NS2.

I tried to remove the right to write data from guest users. I edited /etc/samba/smb.conf :

Code: Select all

[MyShare]
        path = /shares/MyShare
        vfs object = netatalk
        delete veto files = yes
        browseable = yes
        create mode = 0777
        directory mask = 0777
        valid users = "admin"
        writeable = yes
        write list = "admin"
[OpenShare]
        path = /shares/OpenShare
        vfs object = netatalk
        delete veto files = yes
        browseable = yes
        create mode = 0777
        directory mask = 0777
        guest ok = yes
        read only = no
But each times it reboots, this conf go back to default (as above).

Does anybody knows why ?

BTW I haven't find tutorials about what to do when you managed to get SSH root access (I plan on configurating FTP next...)

kalleguld
Posts: 36
Joined: Thu Mar 31, 2011 10:55 am

Re: Samba Configuration (and FTP)

Post by kalleguld » Sat Jun 18, 2011 4:32 pm

Yeah, the Lacie software changes certain config files every chance it gets.
The best way is to tell samba (and proftpd) to use another config file.
Edit the file /etc/initng.d/smbd.i (I think that's what it's called - i'm not using initng myself) find the line starting with
exec daemon = /usr/sbin/smbd, then add
--configfile=/etc/smbd2 to the end of that line. Now samba will look for at file called /etc/smbd2 so remember to create it :)

FireAngel
Posts: 4
Joined: Sat Jun 18, 2011 12:19 pm

Re: Samba Configuration (and FTP)

Post by FireAngel » Sun Jun 19, 2011 10:34 am

Thanks for helping me, but :

I created /etc/samba/smbd2.conf with

Code: Select all

reand only = yes
and I put in initg/samba.i :

Code: Select all

daemon samba/smbd {                                         
        need = bootmisc;                                    
        respawn;        
        exec daemon = /usr/sbin/smbd --configfile=/etc/samba/smbd2 -F
}                                                                    
                                                                     
daemon samba/nmbd {                                                  
        need = bootmisc;
        respawn;        
        exec daemon = /usr/sbin/nmbd -F;
}                                       
                                        
daemon samba/winbind {                  
        need = bootmisc;
        respawn;        
        exec daemon = /usr/sbin/winbindd -F;
}                                           
                                            
virtual samba {                             
        need = samba/smbd samba/nmbd samba/winbind;
        also_stop = samba/smbd samba/nmbd samba/winbind;
}
or

Code: Select all

 ...   
        exec daemon = /usr/sbin/smbd -F --configfile=/etc/samba/smbd2
 ... 
And in either case, I can't access my NS2 with samba, I think samba won't exec (probably a wrong syntax).

Mijzelf
Posts: 6251
Joined: Mon Jun 16, 2008 10:45 am

Re: Samba Configuration (and FTP)

Post by Mijzelf » Sun Jun 19, 2011 10:55 am

There are several possibilities. You could have made an error in your configuration file, or in the startscript.

Some pointers:
  • Have a look in /var/log/ to see if a logfile has some information
  • Is smbd running?
  • Try to start smbd manually:

    Code: Select all

    killall smbd
    /usr/sbin/smbd --configfile=/etc/samba/smbd2 -F
  • Run /usr/sbin/smbd --help, to get information about the commandline syntax.

FireAngel
Posts: 4
Joined: Sat Jun 18, 2011 12:19 pm

Re: Samba Configuration (and FTP)

Post by FireAngel » Sun Jun 19, 2011 3:24 pm

Thanks,
  • Couldn't find useful info on the logs
  • smbd wasn't running
  • I started smbd manually with

Code: Select all

/usr/sbin/smbd --configfile=/etc/samba/smbd2 -F
and it worked as I expected (in read-only mode)

It's some progress, though smbd won't start automatically at booting...

I might take a look at FTP now...

Mijzelf
Posts: 6251
Joined: Mon Jun 16, 2008 10:45 am

Re: Samba Configuration (and FTP)

Post by Mijzelf » Sun Jun 19, 2011 5:37 pm

I think I see the problem.
startscript wrote:exec daemon = /usr/sbin/smbd --configfile=/etc/samba/smbd2 -F
exec daemon = /usr/sbin/nmbd -F;
I suppose you should add a semicolon at the end of the line

kalleguld
Posts: 36
Joined: Thu Mar 31, 2011 10:55 am

Re: Samba Configuration (and FTP)

Post by kalleguld » Mon Jun 20, 2011 8:12 am

O Semicolon, thy are the bane of sanity.

FireAngel
Posts: 4
Joined: Sat Jun 18, 2011 12:19 pm

Re: Samba Configuration (and FTP)

Post by FireAngel » Mon Jun 20, 2011 9:45 am

Oh gosh ! How come I didn't see it ?

Post Reply