LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Closed Thread
  Search this Thread
Old 08-23-2019, 05:21 AM   #1
James_rock
LQ Newbie
 
Registered: Aug 2019
Posts: 4

Rep: Reputation: Disabled
SFTP


Hello Everyone

My Name is James, am a new user in this forum.

I have one issue related the SFTP, I want to enable SFTP access for root user only, other user only access the server by using putty only.


Is it possible to restricted the access of other user for SFTP, If yes please let me know.
 
Old 08-23-2019, 06:50 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by James_rock View Post
Hello Everyone
My Name is James, am a new user in this forum.

I have one issue related the SFTP, I want to enable SFTP access for root user only, other user only access the server by using putty only. Is it possible to restricted the access of other user for SFTP, If yes please let me know.
First thing that comes to mind: what you're doing is a **VERY BAD IDEA**. The root user should NEVER be allowed network access, period, to anything. There's just no reason to do it.

You can change the sftp subsystem to be "internal-sftp", and add:
Code:
Match Group sftpusers
AllowTcpForwarding no
ChrootDirectory %h
ForceCommand internal-sftp
..to the bottom of the sshd_config file, and restart the service. Create a group called "sftpusers", and use the usermod command to add whatever users you want to it. Now, whatever users you add to that group will be able to sftp to their home directories only. Again, allowing root to do ANYTHING over the network is incredibly bad and insecure, and there is zero reason to do it; systems security shouldn't be compromised for something like this.

What's your actual goal?
 
1 members found this post helpful.
Old 08-23-2019, 09:21 AM   #3
James_rock
LQ Newbie
 
Registered: Aug 2019
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks for your reply, i will follow the steps and let you know.


Thanks
 
Old 08-23-2019, 09:29 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by James_rock View Post
Thanks for your reply, i will follow the steps and let you know.
Sorry, but did you not read the entirety of the first reply??

You were asked what your goal was...what are you trying to accomplish by doing this? Why??? There are probably FAR better ways of doing things than allowing root network access. And to reiterate: allowing root access for ANYTHING over the network is **A VERY BAD IDEA**, and there is zero reason to do it.
 
Old 08-23-2019, 10:29 AM   #5
James_rock
LQ Newbie
 
Registered: Aug 2019
Posts: 4

Original Poster
Rep: Reputation: Disabled
see am a senior web developer and Linux admin.

I did a web application and its hosted in Linux web server.

I dont want to show the code other employee, that's why i make other user they can only access the particular directory and access some particular Linux commands, for uploading code and data i will give them sftp access
 
Old 08-23-2019, 11:08 AM   #6
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by James_rock View Post
see am a senior web developer and Linux admin.

I did a web application and its hosted in Linux web server.

I dont want to show the code other employee, that's why i make other user they can only access the particular directory and access some particular Linux commands, for uploading code and data i will give them sftp access
Would instead recommend a Git repository.
 
Old 08-23-2019, 12:36 PM   #7
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by James_rock View Post
see am a senior web developer and Linux admin.
There is absolutely no way you're a Linux administrator or senior web developer.
If you are were truly an administrator, you should know that allowing root over the network is horribly bad. And as a senior web developer, you should ALSO know that uploading files owned by root to a web server could cause issues, not to mention the fact that you have NO ROLLBACK in place for your web server, should bad code get uploaded.
Quote:
I did a web application and its hosted in Linux web server. I dont want to show the code other employee, that's why i make other user they can only access the particular directory and access some particular Linux commands, for uploading code and data i will give them sftp access
And what you say here makes no sense. If you give them root access to upload, they HAVE ROOT ACCESS. They can upload ANYTHING...with ANY executable to your server, have it run as root, and do ANYTHING THEY WANT. You say you don't want to show the code to other employees...so giving them root access lets them DOWNLOAD ANYTHING THEY WANT, and look at it also.

The sudo command is used to restrict what users can run what commands. It would be FAR better to create an FTP only user, that uploads to a different directory other than your web server root. And rtmistler also suggested Git, which is an excellent choice as well, since it lets you see who did what, when, and lets you roll back changes.

Last edited by TB0ne; 08-23-2019 at 01:23 PM.
 
Old 08-24-2019, 11:38 AM   #8
James_rock
LQ Newbie
 
Registered: Aug 2019
Posts: 4

Original Poster
Rep: Reputation: Disabled
@TB0ne

You have lot of ego man.

How dare you pass wrong comment and give the bad review of other people knowledge. Do you know anything about me and do you know my experience and my knowledge.


I just ask a single question and you dint provide me the proper solution and you passed wrong comment and all.


if you have knowledge give me the proper solutions else alternative way . This is final warrning you dont talk in wrong way else you know what i am saying.

What the hell you man
 
Old 08-24-2019, 01:37 PM   #9
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
^ Holy Stallman, should I even report this?
You sure know how to pick'em, TB0ne...
 
Old 08-24-2019, 01:49 PM   #10
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Thread closed
 
2 members found this post helpful.
  


Closed Thread



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
SFTP throwing "End of file" when doing SFTP transfer in perl exceed1 Programming 5 03-06-2010 01:34 PM
how to create sftp user only in red hat 4 not ftp user ..only sftp user princeu28 Linux - Newbie 1 10-14-2008 08:10 AM
cannot login into SFTP server using Net::SFTP cccc Programming 1 10-31-2007 06:23 AM
How do I use sftp to upload my web site? (no sftp tar command) johnMG Linux - Networking 6 06-21-2005 09:14 PM
Files truncated by sftp/sftp-server at 65kb gato Linux - Networking 1 12-18-2003 10:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:48 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