[SOLVED] Running FTP server on unraid - question about chmod and chown


Recommended Posts

I had some help a while back getting FTP users that login to be pointed to one shared folder.  Here they were able to upload / download as needed.  (I use it to store daily backups from my company's servers - each backup going into a subfolder of my FTP share)

 

Lately I have been installing all the latest upgrades and noticed something strange happened.  When I view the FTP folders in my local network share - I don't see any files anymore - but if I view them via FTP client software - I can see everything.

 

Somehow - something with ownership or file permissions got messed up. How can I sort it all out and get everything in all the folders changed to where the files are viewable from both my local network and via FTP?

 

 

Link to comment

OK, 

 

I am not sure I did it right - but here is what I get.

 

root@Tower:~# ls -l /mnt/disk1/ftp/

total 51

drwxrwxrwx 5 root root  120 Nov 13 19:56 Keegan/

drwxrwxrwx 2 root root  3952 Apr 19 01:58 QB/

drwxrwxrwx 2 root root  2232 Apr  2 05:16 bryhall/

drwxrwxrwx 2 root root  608 Apr 19 03:43 cmadvance/

drwxrwxrwx 2 root root  2496 Apr 17 20:13 customizedusbdrive/

drwxrwxrwx 4 root root  104 Apr 16  2010 db_backups/

drwxrwxrwx 2 root root  5808 Mar 28 02:11 emailmarketer/

drwxrwxrwx 2 root root  280 Apr  6  2010 exoticcaragent/

drwxrwxrwx 4 root root 11088 Apr 19 10:58 gcsiorders/

drwxrwxrwx 2 root root  688 Apr  2 04:39 industrialimage/

drwxrwxrwx 2 root root  3424 Apr 13 02:18 logoincluded/

drwxrwxrwx 2 root root  160 Apr 19 00:19 mdisk/

drwxrwxrwx 2 root root  528 Apr  2 10:13 opti3/

drwxr-xr-x 2 root root    88 Apr 17 23:22 plesk-server/

drwxrwxrwx 2 root root  1728 Apr 18 23:18 promo/

drwxrwxrwx 2 root root 16160 Mar 28 03:08 promotionaltechproducts/

drwxrwxrwx 2 root root  1224 Apr 19 21:04 ramexperts/

drwxrwxrwx 2 root root  5040 Apr 18 22:13 rgjess/

drwxrwxrwx 2 root root  160 Apr 19 04:13 wrigleybum/

root@Tower:~#

 

 

those are all the folders in my ftp 

 

 

Here is what one of the contents of one of the folders looks like.

root@Tower:~# ls -l /mnt/disk1/ftp/ramexperts/

total 7184142

-rwxrwxrwx 1 root root 244828160 Feb 28 18:03 backup1_ramexperts.com_1102281759.tar*

-rwxrwxrwx 1 root root 223866880 Feb 21 21:00 backup_ramexperts.com_1102212058.tar*

-rwxrwxrwx 1 root root 223979520 Feb 22 21:00 backup_ramexperts.com_1102222058.tar*

-rwxrwxrwx 1 root root 224860160 Feb 23 21:01 backup_ramexperts.com_1102232058.tar*

-rwxrwxrwx 1 root root 224614400 Feb 24 21:01 backup_ramexperts.com_1102242058.tar*

-rwxrwxrwx 1 root root 244070400 Feb 25 21:01 backup_ramexperts.com_1102252058.tar*

-rwxrwxrwx 1 root root 245626880 Feb 26 21:00 backup_ramexperts.com_1102262058.tar*

-rwxrwxrwx 1 root root 248545280 Feb 27 21:01 backup_ramexperts.com_1102272058.tar*

-rwxrwxrwx 1 root root 420567040 Apr 13 13:28 backup_ramexperts.com_1104131322.tar*

-rwxrwxrwx 1 root root 420577280 Apr 13 13:40 backup_ramexperts.com_1104131334.tar*

-rwxrwxrwx 1 root root 420608000 Apr 13 14:03 backup_ramexperts.com_1104131358.tar*

-rwxrwxrwx 1 root root 418846720 Apr 15 21:06 backup_ramexperts.com_1104152058.tar*

-rwxrwxrwx 1 root root 419072000 Apr 16 09:35 backup_ramexperts.com_1104160927.tar*

-rwxrwxrwx 1 root root 419471360 Apr 16 14:34 backup_ramexperts.com_1104161428.tar*

-rwxrwxrwx 1 root root 419512320 Apr 16 15:04 backup_ramexperts.com_1104161456.tar*

-rwxrwxrwx 1 root root 419512320 Apr 16 15:30 backup_ramexperts.com_1104161522.tar*

-rw-r--r-- 1 root root 419553280 Apr 16 21:04 backup_ramexperts.com_1104162058.tar

-rw-r--r-- 1 root root 420177920 Apr 17 09:45 backup_ramexperts.com_1104170936.tar

-rw-r--r-- 1 root root 420976640 Apr 17 21:04 backup_ramexperts.com_1104172058.tar

-rw-r--r-- 1 root root 423383040 Apr 18 21:05 backup_ramexperts.com_1104182058.tar

-rw-r--r-- 1 root root 426711040 Apr 19 21:04 backup_ramexperts.com_1104192058.tar

root@Tower:~#

 

Link to comment

Anyone have any ideas?

 

Again when I view the files via FTP - I can see everything.  When I view via a network share - I can only see certain files.  I think there is an issue with ownership.  But I am not sure how to make sweeping changes to all my files in the FTP share.

 

 

Link to comment

The New Perm script in the 5.0b series would probably fix the issue you are seeing.

 

Do a search in this forum (the search box only works for the current subforum you are in) and you should find what you need.

 

If I had to guess you are logging into the FTP as root, but not as that user when viewing over the network.  That is probably the reason you see/don't see the files.

Link to comment

The problem is not ownership, it's how samba maps unix file permissions to windows file attributes.  Because the world executable flag is set Samba is showing setting the hidden attribute.  You can set windows to show hidden/system files to confirm.  The solution is to remove the world executable permission but I'm not sure what effect this will have on the ftp server....

 

Pick a file to test with and execute

chmod 644 /path/to/file

then see if you can view the file by browsing to the share with windows.  If so, the samba mapping is definitely your problem and you will need to figure out what the permissions need to be to allow reading/writing via windows and ftp.  Once you have that it's pretty easy to script changing the permissions on everything all at once.

Link to comment

That method works but it's using a shotgun to treat the symptom instead of resolving the problem.  If you are fine with not being able to retain hidden/system attributes than it's not a problem though.

 

As an example, if you copied your user profile from a windows machine to a share after gutting samba's ability to map attributes then copied the profile back there would be a plethora of files/directories that would be restored incorrectly.  Not the end of the world but beware when running like this you may not (depends on how you use your array) get the expected result when you copy files on/off the array.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.