LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-26-2012, 03:04 PM   #1
finch9
LQ Newbie
 
Registered: Nov 2012
Distribution: Slackware
Posts: 6

Rep: Reputation: Disabled
vsftp issue when uploading a file to network windows share


I'm running slackware 14.

my config looks like this.
anonymous_enable=no
local_enable=YES
write_enable=YES
#local_umask=022
local_umask=000
ftpd_banner=FTP.
chroot_local_user=YES
chroot_list_enable=YES
allow_writeable_chroot=YES
chroot_list_file=/etc/vsftpd.chroot_list

The rest of the file is just default commented out.
ssl is enabled as well

I have a windows share setup with permission everyone checked full.

This is setup in the fstab
mount.cifs //Machinename/test /home/ftp/ftpclients -o rw,username=USERNAME,password=PASSWORD 0 0

My newly created users are not put into chroot_list and are locked down to their home directory.
When I log in with that userid I see the folder that was setup under adduser. I can even switch to other folders. I can download a file but can not upload a file. Error 553 could not create file, critical file transfer error.

I'm thinking this has to be security over the folder but i'm lost on how to fix this.
 
Old 11-27-2012, 11:56 AM   #2
lrtward
Member
 
Registered: Feb 2011
Distribution: CentOS, Ubuntu
Posts: 97

Rep: Reputation: 9
Where are the users' home directories located? Are they something like /home/ftp/ftpclients/bob and /home/ftp/ftpclients/mary ?

What directory are you trying to upload to?

What are the permissions on the upload directory?

What do you see in /var/log/vsftpd.log (or wherever you are logging your FTP stuff) immediately after getting the 553 error?
 
Old 11-27-2012, 02:14 PM   #3
finch9
LQ Newbie
 
Registered: Nov 2012
Distribution: Slackware
Posts: 6

Original Poster
Rep: Reputation: Disabled
users homes are created on the mount so mary is /home/ftp/ftpclients/mary

Running ls -l under ftpclients I see permission as drwxr-xr-x 0 root root 0
I created a folder from the windows machine under mary called test. It has the same permissions when i look at it from terminal.

vsftpd.log shows the file t1.txt a _ i r mary ftp 0 * i
 
Old 11-27-2012, 02:44 PM   #4
lrtward
Member
 
Registered: Feb 2011
Distribution: CentOS, Ubuntu
Posts: 97

Rep: Reputation: 9
Looks to me like mary's home directory is only writable by root.

I would try
Quote:
chown mary /home/ftp/ftpclients/mary
chown mary /home/ftp/ftpclients/mary/test
 
Old 11-27-2012, 02:58 PM   #5
finch9
LQ Newbie
 
Registered: Nov 2012
Distribution: Slackware
Posts: 6

Original Poster
Rep: Reputation: Disabled
k this is a bit strange, i'm logged in as root on the terminal.
I ran the commands above and they completed with no errors etc.
I run ls -l and it is still showing drwxr-xr-x 0 root root 0 under both folders.
 
Old 11-27-2012, 03:01 PM   #6
lrtward
Member
 
Registered: Feb 2011
Distribution: CentOS, Ubuntu
Posts: 97

Rep: Reputation: 9
That is a bit strange.
Do you mind doing a copy and paste of your commands and the output so we can see exactly what is happening on your server?
 
Old 11-27-2012, 03:11 PM   #7
finch9
LQ Newbie
 
Registered: Nov 2012
Distribution: Slackware
Posts: 6

Original Poster
Rep: Reputation: Disabled
Sure thing here it is.

Click image for larger version

Name:	chownscreenshot.PNG
Views:	78
Size:	12.7 KB
ID:	11311
 
Old 11-27-2012, 03:33 PM   #8
lrtward
Member
 
Registered: Feb 2011
Distribution: CentOS, Ubuntu
Posts: 97

Rep: Reputation: 9
I mounted a windows file share (cifs) and "touched" a file. All good.
Then I tried to change ownership. All bad. Same as what you're seeing.

I've done a bit of searching, and it seems as though the entire cifs mount is going to have the same owner:group and you can't change it. I'm going to poke around a bit more, and I suggest you do the same.

Bottom line: the problem is the perms on the cifs mount, and you're going to need different ownership for the different subdirectories on that mount. Not sure if that's possible. Windows doesn't have the same notion of ownership as Linux.
 
Old 11-27-2012, 03:41 PM   #9
finch9
LQ Newbie
 
Registered: Nov 2012
Distribution: Slackware
Posts: 6

Original Poster
Rep: Reputation: Disabled
hmm - a previous sys admin here had setup an older version of slackware running on our Vm server.
I've pretty much copied all that was there and the cifs mount there as well.

The permissions on those folder are drwxrwxrwx 1 root root 0.

On the windows side the shared folder is setup same security/share permissions.
 
Old 11-27-2012, 03:48 PM   #10
lrtward
Member
 
Registered: Feb 2011
Distribution: CentOS, Ubuntu
Posts: 97

Rep: Reputation: 9
You might try playing around with the gid and dir_mode arguments for the "mount.cifs" command.

Try to get things set up with the gid option so that the directories are owned by some group (ftpgroup, maybe). Add all your FTP users to that group.

Then use dir_mode to ensure the group permissions on your subdirectories and files are all 7 (i.e. 775).

Then test writing to those directories (FTP upload of a file). This should work, because all your subdirectories will allow full access to anyone in ftpgroup.

Then make sure your chroot_local_user setting in your vsftpd.conf file is keeping folks from messing with each other's directories.
 
Old 11-28-2012, 02:58 PM   #11
finch9
LQ Newbie
 
Registered: Nov 2012
Distribution: Slackware
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thank you lrtward for all of your help.
I have finally been able to upload a file, i'll have to test it a bit more but here is what I have under fstab now.

//servername/test /home/ftp cifs gid=ftp,dir_mode=0777,rw,directio,username=user,password=pass 0 0

I started off by trying gid=ftp but received the same error. Edited the line and added in dir_mode=0777 and after that I was able to upload a file.
 
Old 11-29-2012, 09:17 AM   #12
lrtward
Member
 
Registered: Feb 2011
Distribution: CentOS, Ubuntu
Posts: 97

Rep: Reputation: 9
You're welcome! Actually I didn't really help much, it was just lucky that I had a CIFS share mounted to my own linux box so it was easy for me to play with and realize that the problem was that Windows/CIFS doesn't understand Linux's notion of permissions. In retrospect, it is obvious.

You did all the hard work of playing with the mount options.

Be sure and verify that your FTP users cannot access one another's accounts! I think your vsftpd settings will prevent that, but with wide open permissions you do want to test some to make sure.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Uploading/downloading windows file on linux server tbijisha Linux - Server 7 08-01-2012 02:55 AM
mount windows share export to samba share -> improve network performance tuning newuser77 Linux - Server 1 07-23-2008 11:28 AM
uploading file with POST from PHP issue lukebeales Programming 2 04-23-2008 08:54 PM
VSFTP - problems uploading directories full of content animehair Linux - Software 1 01-03-2005 08:34 AM
How Do I...? vsFTP uploading ronkymac Linux - Security 1 12-08-2004 04:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration