HDsamba Version 3 Available

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Broadcom SoC based Hardware
Goto page Previous  1, 2, 3 ... 19, 20, 21 ... 33, 34, 35  Next
Author Message
y_farkash
DD-WRT Novice


Joined: 16 Jul 2008
Posts: 29

PostPosted: Fri Mar 27, 2009 9:44    Post subject: Reply with quote
And the saga continues:

1) Amorphis: I am not sure how the S80samba script comes into play with user access rights.

2) Amorphis:
Quote:
Out of curiosity what kind of read/write performance are you getting over usb with fat32?


Do you mean performance when the drive is connected directly via usb to the computer, or when the drive is connected to the router and I get a file via Samba? Which OS? How do I get those numbers?


I have made some progress and some regress:
GruenesAlien's suggested to mount the partition onto a different folder which already have the proper permissions. I tried it and it didn't work, the directory permissions would change from drwxrwxrwx to drwxr-xr-x upon mounting. This led me to look into the mounting of FAT32 partitions in general and I found out that you need to use the 'umask' option during the mounting process in order to define the permissions.

As we know, Linux does not really handle permissions on FAT32, but the access rights are decided at mount.
So, using the
Code:

mount -o rw,umask=0000 /dev/discs/disc0/part3 /mnt/data


I get the following:
Code:

root@dd-wrt:/mnt# ls -l
drwxr-xr-x    5 root     root         4096 Mar 17 09:13 HDsamba
drwxrwxrwx    9 root     root        16384 Jan  1  1970 data
drwx------    2 root     root         4096 Mar 20 01:06 lost+found
drwxr-xr-x   11 root     root         4096 Mar 26 22:03 opt


Hurray!

Well, not so easy...

For some reason I seem to not be able to add users to ddwrt or Samba anymore!

Code:

root@dd-wrt:/etc# cat /etc/passwd
root:4DmjkECkVzYy.:0:0:Root User,,,:/tmp/root:/bin/sh
reboot:4DmjkECkVzYy.:0:0:Root User,,,:/tmp/root:/sbin/reboot
nobody:*:65000:65000:nobody:/mnt:/bin/false

root@dd-wrt:/etc# echo "user1::501:501:user:/tmp:/bin/sh" >> /etc/passwd

root@dd-wrt:/etc# cat /etc/passwd
root:4DmjkECkVzYy.:0:0:Root User,,,:/tmp/root:/bin/sh
reboot:4DmjkECkVzYy.:0:0:Root User,,,:/tmp/root:/sbin/reboot
nobody:*:65000:65000:nobody:/mnt:/bin/false
user1::501:501:user:/tmp:/bin/sh

root@dd-wrt:/etc# reboot
Shutting down daemons and swap...
Unmounting USB drive...


Now, after reboot:
Code:

BusyBox v1.13.2 (2009-02-18 19:00:37 CET) built-in shell (ash)
Enter 'help' for a list of built-in commands.

root@dd-wrt:~# cat /etc/passwd
root:4DmjkECkVzYy.:0:0:Root User,,,:/tmp/root:/bin/sh
reboot:4DmjkECkVzYy.:0:0:Root User,,,:/tmp/root:/sbin/reboot
nobody:*:65000:65000:nobody:/mnt:/bin/false


And now I can't even get read access, but no wonder my username/passwd are not recognized!

This used to work before...

What is going on?!?

Same goes for the "/etc/group" file, BUT the /opt/etc/samba/smbpasswd still have the user I added to it.

If I now go and add this user manually again to the "/etc/passwd" and the group to "/etc/group" then I get proper read/write permissions to the share!!!

However, one reboot and it is gone, I get the "\\share is not accessible. You might not have permissions to use this network resource..." message.

I can add two lines to a startup script in order to add the user and the group every startup, but why are the "/etc/passwd" and "/etc/group" files blanked with every reboot?

To close a loop here, Amoprphis, is this is what the 'H80samba' script for? To make sure the users are in the "/etc/passwd" file?

Also, why do we need the "nobody" user?

Life ain't easy, that's for sure. :-)

Thanks for all the help again,

Y.Farkash
Sponsor
MrAlvin
DD-WRT User


Joined: 07 Jan 2007
Posts: 454
Location: Denmark

PostPosted: Fri Mar 27, 2009 11:05    Post subject: Reply with quote
y_farkash wrote:
1) I am not sure how the S80samba script comes into play with user access rights.

/etc/passwd and /etc/group are read only files at boot time. And will thus be reloaded with default values at boot time.

During boot /etc/passwd is copied to /tmp/etc/passwd (and /tmp/etc/ is mounted as /etc/) so any changes you make to /etc/passwd from a script or the command line is actually made to the file: /tmp/etc/passwd
And /tmp/etc/passwd does not survive a reboot. /tmp is a RAM-disk.

So user nobody has to be added to passwd file on every boot.

In HDsamba2 the file S80samba contains the line: "echo "nobody:*:65000:65000:nobody:/mnt:/bin/false" >> /etc/passwd"

You need to add:
- echo "user1::501:501:user:/tmp:/bin/sh" >> /etc/passwd to S80samba
- and also what you would write to /etc/group


File: /opt/etc/samba/smbpasswd is on a rw partition (/opt = on part1 of USB drive, yes?) where changes to the file survives the (re)boot process.


y_farkash wrote:
This led me to look into the mounting of FAT32 partitions in general and I found out that you need to use the 'umask' option during the mounting process in order to define the permissions.

As we know, Linux does not really handle permissions on FAT32, but the access rights are decided at mount.
So, using the
Code:

mount -o rw,umask=0000 /dev/discs/disc0/part3 /mnt/data

VERY good to know! Very Happy
Amorphis
DD-WRT User


Joined: 08 Jan 2009
Posts: 234
Location: Toronto, Ontario

PostPosted: Fri Mar 27, 2009 19:05    Post subject: Reply with quote
nobody is the samba version of the windows guest account as I understand from spending time playing with swat and as Mr. Alvin explained it's wiped on boot. I've read that some samba processes are actually executed under this user account also, although I haven't seen evidence of that in a top command. So there is a samba account manifestation, but also a linux account manifestation of this and all users you create for samba.

So when you set a samba share for guest access it's looking for the nobody login, which you can type in manually when having windows login problems, or remap the bad logins to something else, like root.

For example I've seen lots of this kind of thing:
nobody = guest pcguest smbguest
I'm pretty sure the windows guest account authenticates as "guest" for xp with simple file sharing.
Or set it to your xp machine's creds...

Swat is pretty good for exploring this kind of thing.

As for the drive performance, yes I was totally talking about router-disc transfer speed, with this being the common interest here, I don't use fat32, I use ext3 to avoid these kinds of permission issues, but also because I was told there might be a performance hit... although I never sussed it out.

I also use the ext3 driver in xp that Mr. Alvin refers to, and it works really well.

If you're inclined there is an optware package called hdparm that gives a throughput number.
I get about 12 mb/s with an ext2/3 HD, and I think most posts I've seen are in that 9-12 range... but I haven't seen anybody check with fat32... who knows maybe hdparm doesn't even work with fat32, it's just a curiosity thing if you're curious too, then it'd be cool to compare. Even just a timed copy would be interesting.

Just throwing this out there, but wouldn't a bunch of separately mounted partitions also give you this ability? Like I guess creating some some specific partitions for limited access users that can be mounted as you see fit in linux, and then in samba... just a half formed thought. repartitioning can be annoying, so it may not be practical, but with some of your mount trickery it could work.

Oh, and there should be backup copies of all scripts, and config files in the /mnt/HDsamba/ folder, so the s80 samba file, and the other config files, incase you're running into problems and want to start again.

blindz -
You could try a jffs wipe (found in the webgui) and a reinstall, but you may be out of luck. You might want to start thinking about a 4 parition install now.

The JFFS file system reserves blocks for write errors incurred by the flash memory eventually, like spare storage spots, that is what most if not all of the used space is, the JFFS overhead.
The actual amount of space required for install I've found hard to pin point, because the overhead of the JFFS varies a fair bit for me on each wipe of the flash... kind of weird I know... but up till now I had assumed over 399kb you had enough, less than that the script should issue a warning, and less than 200 the script should not even let you try, cause it's pointless.

Hmm, double checking /jffs is active in the gui might be a good idea too, incase nvram setting got changed or something too... but I'm really suspecting you might have to explore a 4 parition install.

_________________
WRT350N Eko Mega 11296 + HDsamba2 v4 beta
solarman
DD-WRT Novice


Joined: 06 Mar 2009
Posts: 13

PostPosted: Sat Mar 28, 2009 18:20    Post subject: Reply with quote
Hallelujah!

Ok guys, I realize it has been a while since I posted, but Life happens. My original posts are on pages 15 and 16.

@Amorphus

You were correct, it all boiled down to an incorrect network setting, but I think it was either an error in the script that caused it or the fact that I was using Microsoft's command line telnet program. what happened was that while running the HDsamba2 script, I entered the correct subnet of 192.168.0, but the initial 1 was cutoff and what was found in the smb.conf file was 92.168.0...

The router had been working fine for me in it's primary function of serving us te internet, so wen life got busy, I put this to the side. Last night, I finally just sat down and started reading and tinkering. I had to relearn VI to edit the smb.conf file as it has probably been about 9 or 10 years since I have used it, but I finally got it going and it is beautiful!

I am currently uploading all the stuff I want to share with all the computers in our house.

Thanks to you and all the contributors for making this hardware so much more functional and customizeable, and on the samba end, thanks for writing this script to make the process relatively simple.

I still am not able to access SWAT, but i suspect that it is a network issue as well, I just have to figure out where to go to fix it... another day.
DragonMaster
DD-WRT Novice


Joined: 08 Dec 2008
Posts: 3

PostPosted: Sun Mar 29, 2009 16:56    Post subject: Reply with quote
Doesn't work...

EKO build 11793 mini_usb, WL-520gU, clean config, just over 500kB JFFS free space, clean drive with 3 partitions (opt-EXT3/swap/data-EXT3).

Install keeps doing this:

Code:
Downloading http://downloads.openwrt.org/backports/rc5/e2fsprogs_1.38-1_mipsel.ipk ...
Connecting to downloads.openwrt.org (195.56.146.238:80)
e2fsprogs_1.38-1_mip 100% |*******************************|   179k 00:00:00 ETA
Done.
ipkg_install_file: ERROR unpacking control.tar.gz from /jffs/tmp/ipkg/e2fsprogs_1.38-1_mipsel.ipk
ipkg_get_install: ERROR: Failed to install /jffs/tmp/ipkg/e2fsprogs_1.38-1_mipsel.ipk
ipkg_get_install: I'll leave it there for you to try a manual installation

Downloading http://downloads.openwrt.org/backports/rc5/swap-utils_2.12r-1_mipsel.ipk ...
Connecting to downloads.openwrt.org (195.56.146.238:80)
swap-utils_2.12r-1_m 100% |*******************************| 13581  00:00:00 ETA
Done.
Unpacking swap-utils...Done.
Configuring swap-utils...Done.
        VERIFYING: Packages Installs....
        VERIFIED: swap-utils
        WARNING: About to wipe Partition 2 of your HD to make a usable Swap...
        WARNING: Are you absolutely sure there is no useful data stored there?
        WARNING: Press Control-C to terminate the script if you are not sure!
        WARNING: Press ENTER to proceed with swap creation...

/jffs/usr/sbin/mkswap: can't resolve symbol 'setlocale'
        Swap Created!
        ERROR: e2fsprogs not found on /jffs
        ERROR: this might be a connection problem: try again in a bit.
        TERMINATING SCRIPT IMMEDIATELY



and screws up.


I also get this before the install screws up:
Code:
Unpacking base-files-brcm...Done.
Configuring base-files-brcm...Done.
Unpacking base-files...Done.
Configuring base-files...Done.
ipkg_install_file: Warning: libgcc depends on the following uninstalled programs:  base-files
Unpacking libgcc...Done.
Configuring libgcc...Done.
ipkg_install_file: Warning: uclibc depends on the following uninstalled programs:  base-files libgcc
Unpacking uclibc...Done.
Configuring uclibc...Done.



Is there a minimum size for the opt partition? Mine is 16MB if I remember correctly.
blindnz
DD-WRT Novice


Joined: 08 Mar 2009
Posts: 29

PostPosted: Sun Mar 29, 2009 19:39    Post subject: Reply with quote
Dragonmaster i had the exact same issue on my 520gu and my opt partition was 1gb. i think the problem is the lack of jffs space 500k etc... shouldn't it be 2mb remaining?
anyhow i ended up just installing all the optware, samba, ushare manually and it works great.
Amorphis
DD-WRT User


Joined: 08 Jan 2009
Posts: 234
Location: Toronto, Ontario

PostPosted: Mon Mar 30, 2009 19:38    Post subject: Reply with quote
Dragon - Hmm, can you provide us some details about the setup you're attempting? Is it just a straight forward router with single HD, and 3 paritions?

A jffs wipe might be appropriate. I actually have no idea how much more jffs room you need for a mini install versus a normal slim install on a mega build...

The 4 parition approach would also work here, if the packages aren't being unpacked it might suggest there isn't enough /jffs space.

Silly suggestion for now, try a wipe, run the install. And in a second terminal window, keep tabs on the free space of the /jffs parition periodically during the install process... are you running out of room, or is there something more serious happening?

Blindz - Can you provide some more details on what your manual approach to an install entailed? Did you use 4 paritions?

_________________
WRT350N Eko Mega 11296 + HDsamba2 v4 beta
y_farkash
DD-WRT Novice


Joined: 16 Jul 2008
Posts: 29

PostPosted: Tue Mar 31, 2009 4:20    Post subject: Reply with quote
Hi there.

Sorry for disappearing for so long. I kind of screwed up my router and had to perform a little surgery on it. I am glad to report the patient is well.

OK, I think we are successful!

I have a FAT32 partition mounted and shared via either a 'guest' or a user login, with read/write ability.

Amorphis, just a few things:

1) S80samba - When during startup does this get executed? I tried adding users there but it didn't work so I ended up adding a little startup script to /jffs/etc/config in order to add my users to the /etc/passwd file.
Hey, when I think of it, I never added them to the /etc/group file. It still works though...

2) Thanks for the info about the 'nobody' user, it helped with the guest account.

3) As for your request, transfer stats. Note the last partition mounted, type=vfat.

Code:

root@dd-wrt:/# mount
rootfs on / type rootfs (rw)
/dev/root on / type squashfs (ro)
none on /dev type devfs (rw)
proc on /proc type proc (rw)
ramfs on /tmp type ramfs (rw)
/dev/mtdblock/4 on /jffs type jffs2 (rw)
/dev/discs/disc0/part1 on /mnt type ext3 (rw)
/dev/discs/disc0/part1 on /opt type ext3 (rw)
/dev/discs/disc0/part3 on /mnt/data type vfat (rw,noatime)

root@dd-wrt:/# hdparm -t /dev/scsi/host0/bus0/target0/lun0/part3

/dev/scsi/host0/bus0/target0/lun0/part3:
 Timing buffered disk reads:   32 MB in  3.00 seconds =  10.67 MB/sec

root@dd-wrt:/opt/etc/samba# hdparm -t /dev/scsi/host0/bus0/target0/lun0/part1

/dev/scsi/host0/bus0/target0/lun0/part1:
 Timing buffered disk reads:   36 MB in  3.10 seconds =  11.61 MB/sec



A file of 736,110,640 bytes (702MB) took 3:05 min, so that will be 3.8MB/s. I am not sure why a file transfer and the hdparm info is different, but those are the numbers. My computer is connected directly to the router (Asus WL-500W).

Also, notice the difference between the part1 and part3 stats. About 10% difference. Noticeable, but not critical for performance in my opinion. The file system robustness is a good reason to stick to Ext3 though.


OK, so what have we learned?

1) HDsamba2 can be easily modified to use FAT32 partitions.

2) In order to do that you will need the following modifications:

a) In the script '/jffs/etc/config/init.startup' you need to comment out the section that performs the e2fsck disk check, as it does not work on FAT32 and it will hang.

b) In the script '/mnt/HDsamba/scripts/mount.usb' you will have to change the mounting of the NAS (mounting of partition 3) to:
Code:

mount -o noatime,rw,umask=0000 /dev/discs/disc0/part3 /mnt/data


Where the umask=0000 is the critical issue. as I mentioned before, linux will determine the access rights to a FAT32 partition at mount time using the umask option. If you do not set it root will be the only user able to access the FAT32 partition FROM THE OS point of view, which means you will never get Samba to allow any other user to access it. You can try playing with the umask option, it doesnt have to be 0000, if you want to prevent unwanted non-root and non-user access, depending on the complexity of your needs.

c) If your windows log on is without a password or your login name/password is different than the Samba username/password I believe you will need to use the guest account to access the share (haven't tested it, section d below is my case). For this you will need to map the Samba user 'nobody' to a 'guest' user either via swat (under 'global', 'security options' the 'guest account' option should say 'guest' or 'Guest'. If you don't see the line for 'guest account' press the 'advanced view' button) or manually in the '/opt/etc/samba/smb.conf' file by adding a line in the [global] section
Code:

guest account = guest



d) The smoothest (and probably safest under windows) way is to configure your Samba user/password to be the same as the Windows user/password. For this you will need to add a user to the '/etc/passwd' fie first, as a Samba user need first to be a linux user. Afterward you will need to add this user to the Samba user list. Those steps are explained in previous posts in this thread. HOWEVER, as also mentioned earlier, the '/etc/passwd' file is deleted every boot and you will have to use a startup script to add that user with each reboot. The Samba users file is NOT deleted as it is saved on your external HD. For adding such a script see:

http://www.dd-wrt.com/wiki/index.php/Startup_Scripts

and

http://www.dd-wrt.com/wiki/index.php/Script_Execution


OK, I hope that help.

Amorphis, maybe you can put a note in the very first page of this thread (where you introduce the requirements and state the ext3 requirement) directing people to page 21 if they want help with FAT32 (so people who start reading the thread for FAT32 help won't have to read 21 pages to get here).

Thank you all, it has been a great learning experience!

If anyone need help with Fat32 you can PM me.

Cheers,

Y.Farkash
blindnz
DD-WRT Novice


Joined: 08 Mar 2009
Posts: 29

PostPosted: Tue Mar 31, 2009 8:15    Post subject: Reply with quote
Amorphis wrote:

Blindz - Can you provide some more details on what your manual approach to an install entailed? Did you use 4 paritions?


Instead of running the script and having it install to jffs. i just mounted my hdd which was partitioned for opt swap and one for data

mounted opt and then downloaded the optware packages need.
Amorphis
DD-WRT User


Joined: 08 Jan 2009
Posts: 234
Location: Toronto, Ontario

PostPosted: Tue Mar 31, 2009 17:18    Post subject: Reply with quote
Y.Farkash

Just a quick response to your direct question,
S80samba is called from mount.usb to start the samba processes. The wiki has a slightly more detailed elaboration on the boot process, but for all intents and purposes S80samba is used to start the samba daemons, and as such this short script is the most logical place (in my own opinion) to insert code to add linux users to the router for samba purposes.


Thanks also for taking the time to explore the performance penalties and for providing a clean and clear solution on how to use a fat32 volume. Smile

_________________
WRT350N Eko Mega 11296 + HDsamba2 v4 beta
gruenesAlien
DD-WRT Guru


Joined: 27 Nov 2008
Posts: 717

PostPosted: Wed Apr 01, 2009 7:59    Post subject: Reply with quote
I have created a version of HDsamba that supports

- selecting partition (even over different discs)
- hardware swapping save (you can stick you HD-Drive to different ports )

I have to do some cosmetics, nevertheless I want to ask weather it is OK to release it under the name "HDsamba" . It is based on the HDsambav3 script, detection script posted here and my work.
Amorphis
DD-WRT User


Joined: 08 Jan 2009
Posts: 234
Location: Toronto, Ontario

PostPosted: Wed Apr 01, 2009 16:27    Post subject: Reply with quote
Personally I'm all for it, as long as you will take the time to support it and walk people through their problems. I think it's the support and troubleshooting provided by Mr. Alvin, some of the experienced users, and myself (with my occasional rudeness) that made people comfortable with slim-samba2 and HDsamba2

A healthy wiki, and lots of details on how it works helps too.

Let people take it for a spin, identify errors, and improve.11

_________________
WRT350N Eko Mega 11296 + HDsamba2 v4 beta
gruenesAlien
DD-WRT Guru


Joined: 27 Nov 2008
Posts: 717

PostPosted: Wed Apr 01, 2009 20:53    Post subject: Reply with quote
Well, here is it now. Try and see how it works. I think there is still one or another unwanted feature hiding. It's my first shell code and some things are strange even to other scripting languages. Nothing to whine about but that might lead to something not working as intended although I tested things for quite some time now.

So first what is missing: the jffs.repair function I have not ported jet.

You need to copy the script and the tar.gz file both to /tmp/. I have no server that I can abuse to put the file on, but I left in the ability to use wget. Because of that the installation script has ending .txt, I'm not allowed to upload useful endings. That should not be a problem, just chmod +x the file and execute like normal.

The tar.gz file is actually not gzipped because neither 7zip, my openSuse or my dd-wrt produce a tar.gz that can be extracted by dd-wrt. Because of whatever. I coded the install script to support both plain tar and also tar.gz.

I have also changed the standard mount path from /dev/discs/.... to /dev/scsi/host.... because I experienced some errors with the previous paths and micro builds.

I have also quit giving -t ext3 option during mount. I had also suffered problems once I tried a micro install. It should be no big problem to give that command in the safemount function using for mounting (keep in mind that the function is inherited in the different files, you might need to change things at multiple location). Once can also add in a check for partition type and use the appropriate command/option (even native fat32 support can be archived this way, example for how to do that are in detection function, great work not from me). I also want to thank the guy (forgot the name and don't find the post atm) who wrote the detection routine, could not have done it myself and things would not have been so good without:)

Of cause you can ask any questions on the scripts/routines you can of cause change/abuse/rewrite anything.

Perhaps it will make it's was to a official release.

Sebastian



v4Sinstall.HDsamba2.txt
 Description:
Installation file of experimental multiple disc support

Download
 Filename:  v4Sinstall.HDsamba2.txt
 Filesize:  39.85 KB
 Downloaded:  1157 Time(s)


v4HDsamba.tar.gz
 Description:
tar achieve of the script and config

Download
 Filename:  v4HDsamba.tar.gz
 Filesize:  78.5 KB
 Downloaded:  1165 Time(s)

y_farkash
DD-WRT Novice


Joined: 16 Jul 2008
Posts: 29

PostPosted: Fri Apr 03, 2009 3:52    Post subject: Reply with quote
Amorphis wrote:
Y.Farkash

Thanks also for taking the time to explore the performance penalties and for providing a clean and clear solution on how to use a fat32 volume. Smile


Amorphis,

No prob, it was fun! Also, regarding performance: Why do I see the discrepancy between the results of the hdparm (~10mb/s) and the copying (~4mb/s)? Is this normal? Is it related to having FAT vs EXT3?

Also, when are you releasing v4?
Very Happy

Chhers,

Y.Farkash
gruenesAlien
DD-WRT Guru


Joined: 27 Nov 2008
Posts: 717

PostPosted: Fri Apr 03, 2009 21:38    Post subject: Reply with quote
Some new findings:

killing nmbd is causing some disc spinup at least on my side. Killing it will resulted in my disc being quiet for 12+ hours. Network browsing is not possible then but you still can use map network drive and put in IP and share name. This is enough for me.

Also I found that putting this:
[global]
client code page = 850
character set = ISO8859-1

into my smb.conf enables me to to have proper German special signs in windows share and on my hard disc.

This has already been discussed here in short:
http://www.dd-wrt.com/phpBB2/viewtopic.php?t=47375
a link explaining things a bit is here:
http://www.faqs.org/docs/samba/ch11.html#samba2-CHP-11-TABLE-5 . List of codepages on the router is in /opt/lib/codepages

Nothing very new but things have been discussed earlier so I wanted to share my findings.
Goto page Previous  1, 2, 3 ... 19, 20, 21 ... 33, 34, 35  Next Display posts from previous:    Page 20 of 35
Post new topic   Reply to topic    DD-WRT Forum 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