Users for Samba auth??

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Author Message
misguided
DD-WRT Novice


Joined: 05 Oct 2007
Posts: 5

PostPosted: Mon Oct 08, 2007 21:15    Post subject: Users for Samba auth?? Reply with quote
You'll have to forgive me as I'm relatively new at this...
Having been pleased with DD-WRT performance on my WRT54G, and having been thrilled when I added a GL as a wireless bridge, I decided to take it to the next level... I invested in an Asus WL-500W and a couple of hard drives and external cases. The idea was to combine the ssh tunneling and dyndns and all the features I enjoy now, with 1 TB of attached network storage and openvpn, as well as on-router torrent access, without having to leave a computer running. The golden age, if you will.
Having gotten v24 RC3 running on the 500W and gotten the startup script just right, mounting the drives and partitions, I'm doing the optware thing on one of them, running samba2, and trying to set up shares.
At this point, samba is running pretty much out of the box. From windows machines on the network I'm able to read from shares configured with public = yes, but they're currently read-only even though as far as samba is concerned they're set up to be writable...
More importantly, I want to restrict access based on username and password. I would like some shares to be read-only to all users but myself, and some shares to be invisible to anyone but myself... I'd also like all shares to be invisible to anyone who's not a user at all.
As far as I know, though, when you do that you're authenticating against the unix users and groups.
DD-WRT's linux system files are read-only, and no useradd or adduser or direct access to the files in question is supplied.
(I also can't access samba's cgi web interface for some reason, that just doesn't work. So I can't even see if I can set up the restrictions I want using it.)

Someone must be using this kind of configuration, as the optware tutorial has a whole section on setting up samba...

SO, how can you authenticate users if you can't add users to the linux system?
Is there some sort of alternative text-based list of groups and users and passwords that I can actually write to and samba installed in /opt/ will examine? Someone please help me out, as openwrt doesn't sound like it's ready for USB sharing on the WL-500W and if I roll back to the asus stock firmware I lose a lot of the dd-wrt features I love. I'm stalled right now, reading my files but being unable to write any. Sad
Sponsor
misguided
DD-WRT Novice


Joined: 05 Oct 2007
Posts: 5

PostPosted: Tue Oct 09, 2007 19:47    Post subject: Reply with quote
Reading this over, I realise it might not be clear and needs a summary.

Running: DD-WRT v24 SP3
On router: Asus WL-500W
Goal: Running samba2 ON the router, to share drives plugged into the router's USB ports
Problem: How to handle samba user permissions in a sandbox that doesn't allow you to add linux users.

There, nice and succinct... I should have just said it like that in the beginning.
HowardZ
DD-WRT Guru


Joined: 18 Jun 2007
Posts: 706
Location: Maryland

PostPosted: Tue Oct 09, 2007 21:59    Post subject: Reply with quote
I think you can add users to the password file.
If I recall correctly:

Unfortunately, the passwords are encrypted

and you will lose the changes every time the router reboots.

An alternative is to share these disks from a PC on your network.
misguided
DD-WRT Novice


Joined: 05 Oct 2007
Posts: 5

PostPosted: Wed Oct 10, 2007 0:44    Post subject: Reply with quote
Hmm, even if I can write to the passwd file, which I thought I couldn't, yeah the passwords are hashed and I don't know by what scheme so I can't create proper hashed passwords. useradd is designed to do this, I don't know why it's not possible to get it on dd-wrt unless it's by design because users CAN'T be added.
Connecting the drives to a PC and sharing them over the network would defeat the entire purpose. That's just what the hope was to STOP doing. Crying or Very sad
lordb
DD-WRT Novice


Joined: 18 Feb 2008
Posts: 1

PostPosted: Mon Feb 18, 2008 18:21    Post subject: Reply with quote
Does anybody got an answer to this problem ?
Bird333
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 809

PostPosted: Thu Feb 28, 2008 19:26    Post subject: Reply with quote
Add this command to a startup file

Code:
echo "nobody:*:65534:65534:nobody:/var:/bin/false" >> /etc/passwd


Of course replace 'nobody' with your actual username and modify the rest accordingly. Google 'passwd' to understand each part you may need to modify.
soulstace
DD-WRT Guru


Joined: 04 Aug 2007
Posts: 6427

PostPosted: Thu Feb 28, 2008 19:32    Post subject: Reply with quote
the passwords are hashed using crypt() function

https://www.merit.edu/radb/crypt_calculator.html

Tested and working.
Bird333
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 809

PostPosted: Thu Feb 28, 2008 19:48    Post subject: Reply with quote
But to get samba user security to work, you just have to add a user with the command above and then use 'smbpasswd -a username' (replace username with actual name) to add a samba password for that user and then you are off and running.
Cap'n Steve
DD-WRT Novice


Joined: 26 Nov 2007
Posts: 18

PostPosted: Sun Mar 02, 2008 4:45    Post subject: Reply with quote
soulstace wrote:
the passwords are hashed using crypt() function

https://www.merit.edu/radb/crypt_calculator.html

Tested and working.


I just tried running my root password through that and it doesn't match what's already in /etc/passwd. Am I doing something wrong?
soulstace
DD-WRT Guru


Joined: 04 Aug 2007
Posts: 6427

PostPosted: Sun Mar 02, 2008 13:53    Post subject: Reply with quote
Nothing wrong. The generator on that site uses a random salt to give you a different hash each time.
tawei0428
DD-WRT Novice


Joined: 11 Oct 2006
Posts: 4

PostPosted: Tue Dec 23, 2008 10:07    Post subject: Reply with quote
https://www.radb.net/radb/crypt_calculator.html
soulstace
DD-WRT Guru


Joined: 04 Aug 2007
Posts: 6427

PostPosted: Tue Dec 23, 2008 14:40    Post subject: Reply with quote
BTW, with v24 SP1+ you can also use MD5 Crypt hash which is more secure and allows for passwords longer than 8 characters.

You can use the htpasswd tool from apache.org or cygwin distribution.

user@computer ~
$ htpasswd -m -b -c ~/passwd user password
$ cat passwd
$ user:$apr1$TlUYo...$uHE/d4NZQ/MW8F905atLV/

This can be used in general, for any user or purpose.
stillaround2024
DD-WRT Novice


Joined: 25 Jan 2024
Posts: 22

PostPosted: Tue Mar 19, 2024 21:20    Post subject: Almost Priceless .. Reply with quote
Bird333 wrote:
Add this command to a startup file

Code:
echo "nobody:*:65534:65534:nobody:/var:/bin/false" >> /etc/passwd


Of course replace 'nobody' with your actual username and modify the rest accordingly. Google 'passwd' to understand each part you may need to modify.


Bird this little snippet should be on a sticky...I have looked at a lot of threads, howtos etc.only mention was adding unix /linux user with adduser no a dd-wrt command..

Thanks - could not get built in samba to run on network share so installed on entware samba4..
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12921
Location: Netherlands

PostPosted: Wed Mar 20, 2024 6:49    Post subject: Reply with quote
Builds in SMB does set the username/password for you but it is a W.I.P Sad
_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
stillaround2024
DD-WRT Novice


Joined: 25 Jan 2024
Posts: 22

PostPosted: Tue Mar 26, 2024 16:58    Post subject: the code Reply with quote
This code "echo "nobody:*:65534:65534:nobody:/var:/bin/false" >> /etc/passwd"did allow me to successfully add a smbuser to samba. but it became real s.s after reboot.. Samba will not allow a user to be added unless there is a valid linux user...So this becomes a issue "for me" when trying to setup entware samba..

At the end I returned to the built in samba and was able to finally get share working...It looks like the network path is an issue and is effected by the way the usb drive is partitioned.."I did see a partition note on the dd-wrt wiki for samba..

DD-WRT mounts the first partition to the drive label. I can see the issue on windows 7, when accessing the shared drive because the network path is different on the two windows p.c..go figure, but once I mapped the drive all was good..
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum