LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-17-2011, 02:09 AM   #1
machielr
LQ Newbie
 
Registered: Feb 2010
Posts: 27

Rep: Reputation: 0
SFTP sccess to users but getting permissions problems


Good day all

I am hoping that someone can assist me here and it will be greatly appreciated.

I am busy assisting a client who need to receive files from clients using sftp.

We have everything setup in order to sftp to the linux server.

However the files needs to be placed on a windows share.

What I was hoping to do it to setup the users on linux with sftp acess, mount the windows share within linux using cifs and then allow the different users to place files on the mounted share.

the windows share is mounted under /mnt/share

Linux user as example: cifstest with home directory /home/cifstest

There is then a symboliclink called cifstest that points to /mnt/share/cifstest

I am however struggling with the permissions issues as I am new to sftp.

When I test the setup, I am able to log into the linux machine using sftp and I can then use cd to change to the symbolic link directory.

However, as soon as I try to upload a file I get the following message:

Couldn't get handle: Permission denied

I am sure I am doing something wrong here but to give you an idea on what we need to achieve.


1. there will be different clients that need to upload files daily
2. each need their own login details and uploads need to be done via sftp.
3. clients need to sftp to the linux machine and the files that are uploaded should be stored on the windows share for processing by the windows server.

Any help will be greatly appreciated as this needs to be up and running by tomorrow.


Regards
Machiel

Last edited by machielr; 02-17-2011 at 02:17 AM.
 
Old 02-17-2011, 04:45 AM   #2
MCD555
Member
 
Registered: May 2009
Location: Milan, Italy
Distribution: Ubuntu, Debian, Fedora, Oracle Linux
Posts: 109

Rep: Reputation: 10
Quote:
Originally Posted by machielr View Post
Good day all

I am hoping that someone can assist me here and it will be greatly appreciated.

I am busy assisting a client who need to receive files from clients using sftp.

We have everything setup in order to sftp to the linux server.

However the files needs to be placed on a windows share.

What I was hoping to do it to setup the users on linux with sftp acess, mount the windows share within linux using cifs and then allow the different users to place files on the mounted share.

the windows share is mounted under /mnt/share

Linux user as example: cifstest with home directory /home/cifstest

There is then a symboliclink called cifstest that points to /mnt/share/cifstest

I am however struggling with the permissions issues as I am new to sftp.

When I test the setup, I am able to log into the linux machine using sftp and I can then use cd to change to the symbolic link directory.

However, as soon as I try to upload a file I get the following message:

Couldn't get handle: Permission denied

I am sure I am doing something wrong here but to give you an idea on what we need to achieve.


1. there will be different clients that need to upload files daily
2. each need their own login details and uploads need to be done via sftp.
3. clients need to sftp to the linux machine and the files that are uploaded should be stored on the windows share for processing by the windows server.

Any help will be greatly appreciated as this needs to be up and running by tomorrow.


Regards
Machiel
Hi,

if you get a permission denied you should check the permissions of the final directory...
Is the final user able to read/write on that?
Try to give the output of the /mnt/share/cifstest directory:

Code:
ls -l /mnt/share/
and the details on the user cifstest:

Code:
id cifstest
If you want give to more than one user the write grants on that directory you should:

> create a new group (groupadd [your_new_grp])
> add that group to all your users (that need to write on that directory...;-)) (usermod -a -G [your_new_grp] [your_sftp_user])
> profile correctly the the grants of the destionation directory

Last, can you write on the windows machine???
Hope this helps...

Last edited by MCD555; 02-17-2011 at 04:53 AM.
 
Old 02-17-2011, 04:55 AM   #3
machielr
LQ Newbie
 
Registered: Feb 2010
Posts: 27

Original Poster
Rep: Reputation: 0
Hi MCD555

I have tried setting the permissions and groups for the folders, however as soon as I mount the cifs share the local permissions change to rwxr-xr-x even if the shares on the windows side is set to even give full permissions to everyone.



Regards
Machiel
 
Old 02-17-2011, 06:22 AM   #4
MCD555
Member
 
Registered: May 2009
Location: Milan, Italy
Distribution: Ubuntu, Debian, Fedora, Oracle Linux
Posts: 109

Rep: Reputation: 10
Quote:
Originally Posted by machielr View Post
Hi MCD555

I have tried setting the permissions and groups for the folders, however as soon as I mount the cifs share the local permissions change to rwxr-xr-x even if the shares on the windows side is set to even give full permissions to everyone.



Regards
Machiel
What about your fstab settings (what is specified in your /etc/fstab)?
How it is mounted that fs?
 
Old 02-17-2011, 06:26 AM   #5
machielr
LQ Newbie
 
Registered: Feb 2010
Posts: 27

Original Poster
Rep: Reputation: 0
Hi MCD555

I have actually just found a solution.

For those who might be interested in future...

We obviously created a seperate login and folder for each client.

So what I had to do is when I mounted the cifs share on the linux side, I had to specify the uid and gid options with the linux username and group names for the clients.

This mounted the shares with that clients' privileges and everything is now working 100%...

Thank you anyway for the assistance.

Regards
Machiel
 
Old 02-17-2011, 06:38 AM   #6
MCD555
Member
 
Registered: May 2009
Location: Milan, Italy
Distribution: Ubuntu, Debian, Fedora, Oracle Linux
Posts: 109

Rep: Reputation: 10
Wink

Quote:
Originally Posted by machielr View Post
Hi MCD555

I have actually just found a solution.

For those who might be interested in future...

We obviously created a seperate login and folder for each client.

So what I had to do is when I mounted the cifs share on the linux side, I had to specify the uid and gid options with the linux username and group names for the clients.

This mounted the shares with that clients' privileges and everything is now working 100%...

Thank you anyway for the assistance.

Regards
Machiel
Great, you're welcome!
Remember to put this thread solved...
Regards
 
  


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
Chroot SFTP users frist44 Linux - Server 3 07-01-2009 04:40 PM
How to set file permissions using SFTP client thesignchef Linux - Server 3 04-27-2009 12:00 PM
Problem with SFTP permissions diilbert Linux - Networking 0 02-14-2007 09:26 AM
shared folder permissions for SFTP jawilson Linux - Networking 1 07-07-2005 02:42 PM
SFTP permissions lynnwgnr Linux - Security 1 12-01-2003 12:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:03 PM.

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