[SOLVED] SFTP sccess to users but getting permissions problems
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
Distribution: Ubuntu, Debian, Fedora, Oracle Linux
Posts: 109
Rep:
Quote:
Originally Posted by machielr
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...
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.
Distribution: Ubuntu, Debian, Fedora, Oracle Linux
Posts: 109
Rep:
Quote:
Originally Posted by machielr
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?
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%...
Distribution: Ubuntu, Debian, Fedora, Oracle Linux
Posts: 109
Rep:
Quote:
Originally Posted by machielr
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.