PDA

Bekijk de volledige versie : [HowTo] Install and Configure a WORKING Samba (Vista included)



Arise
26-09-2007, 18:24
Disclaimer.
Don't know if this guide works from head to tail.
I've composed it from my remberings. But if you have a little knowledge about linux you should understand if there is anything missing or wrong.
Please tell me, so I could update the how to.

I assume you already installed the basics (steps from other tutorials).

Let's get started...




# Login to the web interface and disable the experimental Samba.

# Uninstall any previous xinetd/samba2/samba3 you might have tried with no succes
# Do not remove xinetd if you might need it !!!


ipkg remove xinetd
ipkg remove samba2
ipkg remove samba

#I suggest you should go to /opt/etc/init.d and remove any SXXSamba file you might have there (XX is a number)



# Get the better ipkg


wget http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/ipkg-opt_0.99.163-9_mipsel.ipk
ipkg.sh install ipkg-opt_0.99.163-9_mipsel.ipk

# Get the better uclibc


wget http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/uclibc-opt_0.9.28-12_mipsel.ipk
ipkg.sh install uclibc-opt_0.9.28-12_mipsel.ipk

# Update the list using the improved ipkg


ipkg update

# Now upGRADE your system:


ipkg upgrade
ipkg list_installed

# Create a download folder for Samba, go there and download the latest version (in this case samba_3.0.26a-1_mipsel.ipk)


mkdir /opt/sambaNew
cd /opt/sambaNew
wget http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/samba_3.0.26a-1_mipsel.ipk

# Install this version of Samba


ipkg install samba_3.0.26a-1_mipsel.ipk

# This is my working smb.conf file located in /opt/etc/samba
# edit it with your favorite editor, for example nano


nano /opt/etc/samba/smb.conf

# Copy paste the green lines below in your smb.conf



[global]
workgroup = YOUR_WORKGROUP
guest account = nobody
security = share
browseable = yes
guest ok = yes
guest only = no
log level = 1
max log size = 100
encrypt passwords = yes
dns proxy = no
netbios name = Working_Samba
server string = Router wl500gPremium working with Vista.

[share1]
path=/opt/share/samba1
read only = no
writeable = yes
browseable = yes
public = yes



# Create the physical shared folder on your partition


mkdir /opt/share/samba1
#In order to read/write to this folder you have to give rights permissions.


chmod 777 /opt/share/samba1

# The final command...


flashfs save && flashfs commit && flashfs enable && reboot

# Not sure if this is required, but in Windows Vista, you should run secpol.msc
# then in the left tree select Local Policies > Security Options
# then in the right open Network security: LAN Manager authentication level
# and select Send LM & NTLM - use NTLMv2 security if negotiated instead of Send NTLMv2 response only.

# Now you should have a working Samba share accesible even from Windows Vista.

Cheers,
Arise

Arise
27-09-2007, 08:18
I forgot something...

# In the /opt/etc/init.d/S08samaba file you should make a little change.
# So, in your favorite editor, do like:


nano /opt/etc/init.d/S08samaba

# and change samba_active=0 to samba_active=1

wengi
27-09-2007, 16:20
Thank you for the tut.
Could you give us some facts on memory and cpu consumption of samba3?
My personal opinion is that samba3 is a bit too much for that less ram (esp. for my WL-HDD).

wengi

Michiel
06-10-2007, 20:35
Thanks for the tutorial,

it's working fine on my wl500gP! I didn't change anything in my vista security policies...

wknaap
17-10-2007, 21:49
I've been seeking on this forum.

I'm running the default samba version 2
The only thing I changed to get a VISTA client working is
modify a policy.

start | run | secpol.msc

Go to Local Policies | Security Options and find Network Security: LAN Manager authentcation level

Change settings from: SendNTLMv2 response only
to: NTLMv2 session security if negotiated

Michiel
03-11-2007, 18:31
In some way I can't get to the secpol.msc.. maybe it has to do something with my dutch vista home premium?

But I was wondering if I can make Samba 3 run as a xinetd service so that it only uses memory/cpu when I need it. Is this possible?

QMax
03-11-2007, 19:12
Same problem here, no way to find secpol.msc on my italian Vista OS.
It seems secpol is available only on some high-level Vista version...
but I've found this:

If you're running a version of Vista that cannot use secpol.msc, you can edit the registry instead. Just change the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Lsa\LMCompatibilityLevel from a 3 to a 1.

Actually my battery is very very low... I'll test it after a recharge...

Max

QMax
03-11-2007, 21:11
It doesn't work for me, I still continue having the error msg from Win that I've not the necessary rights to access that folder.

EDIT: Can someone with a working Samba2/Vista environment, post me his smb.conf file please ?

My suspect is that Vista use encrypted password, and in my smb.conf: encrypt passwords = no

Thanks


Max

mlovelace
04-11-2007, 17:17
Let me start this with "GREAT WORK" I have had some fun with this....:D

Install of samba 3 went fine:D

[admin@BestCat etc]$ wget http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/samba_3.0.26a-1_mipsel.ipk
Connecting to ipkg.nslu2-linux.org[140.211.167.165]:80
samba_3.0.26a-1_mips 100% |*****************************| 21324 KB 00:00 ETA
[admin@BestCat etc]$
[admin@BestCat etc]$ ipkg install samba_3.0.26a-1_mipsel.ipk
Installing samba (3.0.26a-1) to /opt/...
Configuring samba
The original samba version 2 config (/etc/samba/smb.conf) is no longer
working with this version of samba.
Please create a new samba version 3 config (/opt/etc/samba/smb.conf).
After verify your smb.conf file, modify and execute /opt/etc/init.d/S08samba
to activate the samba version 3.
Successfully terminated.


Here is the current version of S08samba
[admin@BestCat init.d]$ cat /opt/etc/init.d/S08samba
#!/bin/sh

# set samba_active=1 to activate samba
samba_active=1

[ 1 = $samba_active ] || exit 0

if [ -n "`pidof smbd`" ] ; then
echo "Stopping smbd:"
killall smbd
fi

if [ -n "`pidof nmbd`" ] ; then
echo "Stopping nmbd:"
killall nmbd
fi

sleep 2
/opt/sbin/smbd -D -l /opt/var/log/smbd.log -s /opt/etc/samba/smb.conf
/opt/sbin/nmbd -D -n myasus -o -l /tmp -s /opt/etc/samba/smb.conf


And smb.conf
[admin@BestCat init.d]$ cat /opt/etc/samba/smb.conf
[global]
domain master = no
local master = no
preferred master = no
hosts allow = 192.168.
socket options = TCP_NODELAY IPTOS_LOWDELAY
workgroup = Damnynke
guest account = nobody
security = share
browseable = yes
guest ok = yes
guest only = no
log level = 1
max log size = 100
encrypt passwords = yes
dns proxy = no
netbios name = Working_Samba
server string = Router wl500gPremium

[share1]
path=/opt/share/samba1
force user = admin
writeable = yes
browseable = yes
public = yes

[share2]
path = /tmp/harddisk
force user = admin
writeable = yes
browseable = yes
public = yes

However, I seem to be missing a specific version of libsasl2.so:(
[admin@BestCat init.d]$ ./S08samba
/opt/sbin/smbd: can't load library 'libsasl2.so.2'
/opt/sbin/nmbd: can't load library 'libsasl2.so.2'

Any clues where I can get the correct version?

Any help would be greatly appreciated.
Mark

esurfer
05-11-2007, 15:28
what version of samba and firmware are you using?
i couldn't get mine to work. running kamikaze and samba 2.0.10-4 from x-wrt
thanks.


I've been seeking on this forum.

I'm running the default samba version 2
The only thing I changed to get a VISTA client working is
modify a policy.

start | run | secpol.msc

Go to Local Policies | Security Options and find Network Security: LAN Manager authentcation level

Change settings from: SendNTLMv2 response only
to: NTLMv2 session security if negotiated

QMax
05-11-2007, 21:39
No way for me to access to my USB connected to 500gP running original Samba from Oleg's firmware (Samba 2.0.10-security-rollup).
I'll try installing Samba2...

In the meantime I've found that my Vista Home Premium can't browse shared folders on a Win2000 SP4 machine... no problems browsing from XP....

Any reports about how samba 3 works on small memory amount devices ?

Max

rj.2001
17-11-2007, 02:20
Hello,

this works fine for me with Olegs FW 1.9.2.7-8
But with the FW 1.9.2.7-8 you must do the following steps:

Install the better IPKG:

mkdir /opt/tmp
mkdir /opt/tmp/ipkg
ipkg.sh update
ipkg.sh install ipkg-opt
ipkg update
ipkg upgrade

Stop SAMBA2:

killall nmbd
killall smbd

Disable the SAMBA2 that comes with the FW:
if you create a startup script for Samba:

chmod -x /opt/etc/init.d/S97Samba
if not, be shure that SAMBA is disabled in the WEB-Interface!
You can't uninstall it.. see:
ipkg list_installed

Save the old SAMBA2 configuration if you create one:

mv /opt/etc/samba/smb.conf /opt/etc/samba/smb.conf.smb2

Install SAMBA 3.0.26a-1:

ipkg install sama

Configure your smb.conf.
Thats my:

[global]
workgroup = MATRIX
guest account = nobody
security = share
browseable = yes
guest ok = yes
guest only = no
log level = 0
log file = /opt/logs/smbd.log
max log size = 100
encrypt passwords = yes
dns proxy = no
netbios name = WL500gP
server string = ASUS WL500g Premium
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_SNDBUF=8192

[share$]
path=/
writeable = yes
force user = root
browseable = no

[harddisk$]
path=/tmp/harddisk
writeable = yes
force user = root
browseable = no

[flash$]
path=/opt
writeable = yes
force user = root
browseable = no

[www]
path=/tmp/harddisk/www
writeable = yes
force user = root
browseable = yes

[ftp_pvt]
path=/tmp/harddisk/ftp_pvt
writeable = yes
force user = root
browseable = yes

[ftp_pub]
path=/tmp/harddisk/ftp_pub
writeable = yes
force user = root
browseable = yes

[logs]
path=/opt/logs
writeable = yes
force user = root
browseable = yes

/opt is a usb-flash-stick
and /tmp/harddisk is a usb-hdd

Don't forget...

flashfs save && flashfs commit && flashfs enable && reboot
at the end :)


In my case, i does'nt change any value with the secpol.msc or in the registry of my WinVista Ultimate OS.

I hope this helps also :)

rj.2001
17-11-2007, 02:25
However, I seem to be missing a specific version of libsasl2.so:(
[admin@BestCat init.d]$ ./S08samba
/opt/sbin/smbd: can't load library 'libsasl2.so.2'
/opt/sbin/nmbd: can't load library 'libsasl2.so.2'


You must install the better ipkg!!! :)
But after that, you must mostly reinstall many other packages! E.g. Nano :mad:

Arise
26-11-2007, 11:41
I think you can upgrade all packages in one command with something like:

ipkg upgrade

wirespot
29-11-2007, 02:56
It would also probably be a good idea to add "socket adress = ip", where ip is your br0 address (router LAN ip). Find it with 'nvram get lan_ipaddr' or 'ifconfig br0'.

You don't want to leave all the security to the firewall.

MvAngel
21-12-2007, 21:42
I have the following problem. I have installed the new samba as per the tutorials, but my smbd process doens start with the options as per /opt/etc/samba/smb.conf

143 admin 408 S /opt/sbin/cron
148 admin 732 S dropbear
149 admin 576 S -sh
184 admin 732 S dropbear
185 admin 576 S -sh
189 admin 328 S tail -f /opt/var/log/smbd.log
264 admin 1392 S /opt/sbin/nmbd -D -n homesweethome2 -o -l /tmp -s /opt/etc/samba/smb.conf
275 admin 2072 S [smbd]
276 admin 2008 S [smbd]
283 admin 720 S dropbear
284 admin 556 S -sh
288 admin 404 R ps

in the /opt/var/log/smbd.log I can see the following:

[2007/12/21 20:04:53, 0] source/auth/auth_util.c:get_root_nt_token(501)
get_root_nt_token: getpwnam"root") failed!
[2007/12/21 20:04:53, 0] source/auth/auth_util.c:get_root_nt_token(501)
get_root_nt_token: getpwnam"root") failed!
[2007/12/21 20:04:53, 0] source/services/services_db.c:svcctl_init_keys(420)
svcctl_init_keys: key lookup failed! (WERR_ACCESS_DENIED)

does anybody have any ideas? :confused:

thanks

Arise
21-01-2008, 20:57
Delete that log and try again... does the same errors appear again?

What user do you have on the router? admin or root?

calebz
22-01-2008, 16:27
Hello

For kamikaze you need to make a little different startup script.
Im not a expert so correct the script if I got something wrong but it works for me.


#!/bin/sh /etc/rc.common

START=50
STOP=50


start()
{
echo -n "Starting samba "
/opt/sbin/nmbd -D
/opt/sbin/smbd -D
echo "Done."
}
stop()
{
echo -n "Stopping samba: "
killall smbd
killall nmbd
echo "Done."
}
restart()
{
stop
sleep 2
start
}



Also you need to put it into /etc/init.d or /opt/etc/init.d/ and ofcouse enable it with : '/etc/init.d/scriptname enable. Then it goes to rc.d as SXXsamba.

Also remember about putting the START value to your specific config if your share is on usbhdd
Example: If your hdd mount is START=55 then samba value for START must be >55. Maybe it would work if you set below but why try :P

piezomotor
24-01-2008, 13:57
Hi, I just upgraded samba as per this info below, but I can not access (I can see them) all these folders, it would not let me from Windows.

here is my config:

Код:
[global]
workgroup = HOME
guest account = nobody
security = share
browseable = yes
guest ok = yes
guest only = no
log level = 0
log file = /opt/logs/smbd.log
max log size = 100
encrypt passwords = yes
dns proxy = no
netbios name = WL500gP
server string = ASUS WL500g Premium
socket options = WL500g Premium

[share$]
path=/opr/share
writeable = yes
browseable = yes
public = yes


[harddisk$]
path=/opt/harddisk
writeable = yes
browseable = yes
public = yes

[www]
path=/tmp/harddisk/www
writeable = yes
browseable = yes
public = yes

[ftp_pvt]
path=/tmp/harddisk/ftp_pvt
writeable = yes
browseable = yes
public = yes


[ftp_pub]
path=/tmp/harddisk/ftp_pub
writeable = yes
browseable = yes
public = yes


[logs]
path=/opt/logs
writeable = yes
browseable = yes
public = yes

Any idea why?

Thanks.

wengi
24-01-2008, 16:23
guest account = nobody

you should use an account that has access to the files.
nobody is not a good choice.
try admin if you do not have any security worries.

wengi

calebz
24-01-2008, 17:03
Hi, I just upgraded samba as per this info below, but I can not access (I can see them) all these folders, it would not let me from Windows.
Thanks.

chmod 777 /foldername for each shared directory.

flogged11
30-01-2008, 03:39
Followed all the steps. Tried it in firmware xxx - 7g and xxx - 8, with a number of things that I thought might help, but no luck. It seems that any (all) the newly created files in the /opt/sbin dir are 'not found'??

Any ideas?

output:

/opt/etc/init.d/S08samba: /opt/etc/init.d/S08samba: 21: /opt/sbin/nmbd: not found
Starting smbd:
/opt/etc/init.d/S08samba: /opt/etc/init.d/S08samba: 23: /opt/sbin/smbd: not found

ls-l /opt/sbin

-rwxr-xr-x 1 admin root 7696 Jan 30 02:03 accept
-rwxr-xr-x 1 admin root 8072 Jan 24 13:16 cupsaddsmb
-rwxr-xr-x 1 admin root 7876 Jan 24 13:16 cupsctl
-rwxr-xr-x 1 admin root 404272 Jan 24 13:16 cupsd
lrwxrwxrwx 1 admin root 6 Jan 30 02:03 cupsdisable
lrwxrwxrwx 1 admin root 6 Jan 30 02:03 cupsenable -
-rwxr-xr-x 1 admin root 32272 Jan 24 13:16 cupsfilter
-rwxr-xr-x 1 admin root 24064 Jan 24 13:16 lpadmin
-rwxr-xr-x 1 admin root 8756 Jan 24 13:16 lpc
-rwxr-xr-x 1 admin root 8044 Jan 24 13:16 lpinfo
-rwxr-xr-x 1 admin root 7096 Jan 24 13:16 lpmove
-rwxr-xr-x 1 admin root 26956 Jan 25 07:59 mount.cifs
lrwxrwxrwx 1 admin root 17 Jan 30 02:05 mount.smbfs
smbmount
-rwxr-xr-x 1 admin root 1307664 Jan 25 07:59 nmbd
lrwxrwxrwx 1 admin root 6 Jan 30 02:03 reject -> ac
-rwxr-xr-x 1 admin root 4555052 Jan 25 07:59 smbd
-rwxr-xr-x 1 admin root 2680364 Jan 25 07:59 swat

piezomotor
31-01-2008, 02:20
guest account = nobody


Thanks, it works, now I have connected NTFS 1TB HD to my WL500gP via usb hub it was identified as

/dev/scsi/host1/bus0/target0/lun0/part1

It works for me fine, but it loos like long file names are not supported?


ashwin~1 cowboy~1 t sleepy~1 wd_mac~1
docume~1

Any idea how this can be fixed?

Thanks.

TBS
13-12-2008, 22:03
Hi!


Followed all the steps. Tried it in firmware xxx - 7g and xxx - 8, with a number of things that I thought might help, but no luck. It seems that any (all) the newly created files in the /opt/sbin dir are 'not found'??

output:

/opt/etc/init.d/S08samba: /opt/etc/init.d/S08samba: 21: /opt/sbin/nmbd: not found
Starting smbd:
/opt/etc/init.d/S08samba: /opt/etc/init.d/S08samba: 23: /opt/sbin/smbd: not found


Just as I had the same problem and didn't find an answer anywhere:
I installed uclibc-opt, and everything now works like a charm.

- TBS

bodvar
11-02-2009, 20:22
Hi,

I can not start S08samba at all. I try

./S08samba

and it says "starting samba" and "starting nmbd" but it doesn't appear in list when I type ps.

Is it possible that its not enough mamory?

wirespot
12-02-2009, 08:19
It would show up as "[smbd]", you sure it's not there?

You can also check by running `netstat -tln`, it should show something listening to port 139, like this:


tcp 0 0 192.168.123.254:139 0.0.0.0:* LISTEN

If it's really not starting then look in /opt/var/log/samba, there are some log files there. Check at the end of them, there might be a clue of what's going on.

Why do you worry about memory, you doing anything to consume a lot of it? Like running lots of other big programs? Usually Samba should work without a problem.

audiophil
29-10-2009, 11:02
How do you make this work with logons?
I want to password protect my share since I'm on a shared WLAN. Haven't been able to logon from my Win7 box. Applied all of the registry hacks here, and elsewhere...

How does your smb.conf look like for successful login-support? Do you use ./smbpasswd?

wirespot
29-10-2009, 19:20
Here's a working /opt/etc/samba/smb.conf. I'm assuming you have an USD HDD or flash stick mounted at /opt and an extended system installed there.

This smb.conf will let you share a certain directory with a user and password set in /opt/etc/samba/smbpasswd with the smbpasswd command-line util. Adjust the "hosts allow" and "socket address" to match your LAN configuration. The first says which IP's are allowed to connect and the second what IP to listen on (the router LAN IP).


[global]
workgroup = WORKGROUP
server string = Samba Optware Server
hosts allow = 192.168.123.
printcap name = /etc/printcap
load printers = no
log file = /opt/var/log/samba/log.%m
max log size = 50
security = share
encrypt passwords = yes
smb passwd file = /opt/etc/samba/smbpasswd
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
interfaces = br0
socket address = 192.168.123.254
dns proxy = no
preserve case = yes

[files]
comment = Files
path = /opt/files
valid users = smbuser
public = no
writable = yes
printable = no
create mask = 0660
directory mask = 6770

To mount the share, I do this (from Linux):


smbmount //192.168.123.254/files ~/router/ \
-o credentials=~/.samba/auth,dom=WORKGROUP,\
uid=localuser,gid=localgroup,\
file_mode=0660,dir_mode=0770

~/.samba/auth holds the user and password which you have set with smbpasswd on the router, in the following format (so I don't have to type it manually):


username=smbuser
password=smbpass

Take care to chmod 600 ~/.samba/auth.

duvik
02-06-2013, 21:58
I have Asus Wl-500gp router with Samba 2 built in the firmware (Oleg version WL500gp-1.9.2.7-10). This Samba was working well. The installation of Samba 3.6


ipkg install samba36

was without problems and smbd and nmbd are automatically started after reboot:


151 admin 1976 S /opt/sbin/nmbd -D
153 admin 3600 S /opt/sbin/smbd -D
165 admin 3480 S /opt/sbin/smbd -D


Here is also the log from /opt/var/samba/log.nmbd file after rebooting the router:


[2013/06/01 13:23:09, 0] nmbd/nmbd.c:861(main)
nmbd version 3.6.15 started.
Copyright Andrew Tridgell and the Samba Team 1992-2011
[2013/06/01 13:23:09, 1] param/loadparm.c:9670(lp_load_ex)
WARNING: The security=share option is deprecated
[2013/06/01 13:23:09, 1] param/loadparm.c:9670(lp_load_ex)
WARNING: The security=share option is deprecated

and log.smbd file:


[2013/06/01 13:23:10, 0] smbd/server.c:1072(main)
smbd version 3.6.15 started.
Copyright Andrew Tridgell and the Samba Team 1992-2011
[2013/06/01 13:23:10, 1] param/loadparm.c:9670(lp_load_ex)
WARNING: The security=share option is deprecated
[2013/06/01 13:23:10.290456, 1] param/loadparm.c:9670(lp_load_ex)
WARNING: The security=share option is deprecated

I also tried the option


security = user

to suppress the warning message but the result was the same - in Windows XP or 7 no connection to Samba share is established. The same connection which was working with Samba 2.
Here is my smb.conf file:


[global]
workgroup = WORKGROUP
guest account = admin
security = share
map to guest = Bad User
browseable = yes
guest ok = yes
guest only = yes
log level = 1
max log size = 100
encrypt passwords = no
preserve case = yes
short preserve case = yes
dns proxy = no
netbios name = ASUS_SAMBA
server string = Asus WL-500W
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_SNDBUF=8192
bind interfaces only = yes
interfaces = 192.168.1.2/24
hosts allow = 192.168.1.2/255.255.255.0
printcap name = /dev/null
load printers = no
printing = bsd

[z]
path = /tmp/mnt/disc1_3
writeable = yes
browseable = yes
force user = admin

Would you have an idea why it is not working? What can I try or check? I have no more ideas.