LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-02-2018, 10:52 AM   #1
hz36t5
LQ Newbie
 
Registered: Apr 2014
Posts: 7

Rep: Reputation: Disabled
Redhat SFTP


It appears that by default the location that SFTP uses to look for the users keys for protocol version 1 is ~/.ssh/identity; and ~/.ssh/id_rsa or ~/.ssh/id_dsa for protocol version 2.

Is there a setting in the etc/ssh/sshd_config that can be configured to change this location for all users? Share a directory with all the keys or have one file with all keys?

Goal:
All user authenticate to SFTP using keys and be locked to the same shared home directory.
 
Old 04-02-2018, 11:45 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,650

Rep: Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970
Quote:
Originally Posted by hz36t5 View Post
It appears that by default the location that SFTP uses to look for the users keys for protocol version 1 is ~/.ssh/identity; and ~/.ssh/id_rsa or ~/.ssh/id_dsa for protocol version 2. Is there a setting in the etc/ssh/sshd_config that can be configured to change this location for all users?
Read the man page on sshd_config, or the documentation on setting up openssh. The AuthorizedKeysFile directive is what you're looking for.
Quote:
Share a directory with all the keys or have one file with all keys?
Neither is a good idea for security purposes.
Quote:
Goal: All user authenticate to SFTP using keys and be locked to the same shared home directory.
Then why have separate users at all, if you want everyone to read/write to the same directory? Not much point in separate users, then. You can chroot sftp (there are how-to guides), but that typically jails users to their own home directories.

Read the "Question Guidelines" link in my posting signature. We're happy to help, but please do basic research first; and since you're using RHEL, have you contacted Red Hat support for guidance? You are PAYING FOR RHEL, RIGHT????
 
Old 04-02-2018, 12:17 PM   #3
hz36t5
LQ Newbie
 
Registered: Apr 2014
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
Read the man page on sshd_config, or the documentation on setting up openssh. The AuthorizedKeysFile directive is what you're looking for.

Neither is a good idea for security purposes.

Then why have separate users at all, if you want everyone to read/write to the same directory? Not much point in separate users, then. You can chroot sftp (there are how-to guides), but that typically jails users to their own home directories.

"For traceability of users login/actions while connected."

Read the "Question Guidelines" link in my posting signature. We're happy to help, but please do basic research first; and since you're using RHEL, have you contacted Red Hat support for guidance? You are PAYING FOR RHEL, RIGHT????
"Currently using RHEL Ent 7 trial which has ended."

I will read the Read the "Question Guidelines" link now.
 
Old 04-02-2018, 02:41 PM   #4
Medievalist
Member
 
Registered: Aug 2003
Distribution: Dead Rat
Posts: 191

Rep: Reputation: 56
Quote:
Originally Posted by TB0ne View Post
Then why have separate users at all, if you want everyone to read/write to the same directory? Not much point in separate users,
Having separate users using the same resources allows you to revoke access to individuals without disabling everyone else. However, if they all use the same ssh key as access credentials, you're right, it's completely pointless.

Quote:
You can chroot sftp (there are how-to guides), but that typically jails users to their own home directories.
I haven't seen any real clean implementations that allow strong logging. For example Red Hat EL7's rsyslog can't manage more than a small number of logging sockets, so you can't have one in each chroot, and have to pass logging traffic through some less secure method or put logs in files that are available inside the chroot.
 
Old 04-03-2018, 06:07 AM   #5
hz36t5
LQ Newbie
 
Registered: Apr 2014
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Medievalist View Post
Having separate users using the same resources allows you to revoke access to individuals without disabling everyone else. However, if they all use the same ssh key as access credentials, you're right, it's completely pointless.



I haven't seen any real clean implementations that allow strong logging. For example Red Hat EL7's rsyslog can't manage more than a small number of logging sockets, so you can't have one in each chroot, and have to pass logging traffic through some less secure method or put logs in files that are available inside the chroot.
I don't want them all to have the same ssh key. I want each user to continue to have a separate ssh key. I just want all of the keys in the same directory. Or, if it is possible the continue to have all of the users ssh keys in separate directories, but everyone have the same home directory. Does that make sense? At then end of the day, I want all users to log in using their ssh keys but everyone have the same home dir.

Last edited by hz36t5; 04-03-2018 at 06:10 AM.
 
Old 04-03-2018, 06:40 AM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,650

Rep: Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970
Quote:
Originally Posted by hz36t5 View Post
I don't want them all to have the same ssh key. I want each user to continue to have a separate ssh key. I just want all of the keys in the same directory. Or, if it is possible the continue to have all of the users ssh keys in separate directories, but everyone have the same home directory. Does that make sense? At then end of the day, I want all users to log in using their ssh keys but everyone have the same home dir.
Again, you can put the keys anywhere you'd like, as per the directive given to you earlier. However, you are now going to add complexity to how someone connects, and your system is going to be harder to administer. Because if you have one 'home directory' for all of these users, the keys are going to have to have separate names. so id_rsa will have to be named uniquely for each user, like "pjones_id_rsa", etc. Then they will have to connect by specifying which key file, like "ssh user@server -i /home/dir/.ssh/pjones_id_rsa".

And you're STILL going to wind up with a security hole; because EVERY USER will have to have read access to the keyfile location. So what is to stop them from copying ALL OF THEM to their own system, and doing whatever they want with them?

Think about what you're doing, and about a better way of doing it. Create a directory somewhere, that is JUST for SFTP. Then create a symlink to that directory, in everyones home directory, and chroot SFTP users to their own homes. Key management is easy, security is easy, and everyone can read/write to the one directory you're interested in.

Quote:
Originally Posted by hz36t5
"Currently using RHEL Ent 7 trial which has ended."
Then you need to PAY FOR RHEL, or stop where you are and load CentOS. Not paying for RHEL is an incredibly bad move if you're going into production, because you WILL NOT get patches/security updates/bugfixes, or anything else. Your system will get insecure and unstable, pretty quick. And you won't be able to load new software as easily, since you won't have access to online repositories. Pay for RHEL, or use CentOS.
 
Old 04-03-2018, 06:46 AM   #7
hz36t5
LQ Newbie
 
Registered: Apr 2014
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
Again, you can put the keys anywhere you'd like, as per the directive given to you earlier. However, you are now going to add complexity to how someone connects, and your system is going to be harder to administer. Because if you have one 'home directory' for all of these users, the keys are going to have to have separate names. so id_rsa will have to be named uniquely for each user, like "pjones_id_rsa", etc. Then they will have to connect by specifying which key file, like "ssh user@server -i /home/dir/.ssh/pjones_id_rsa".

And you're STILL going to wind up with a security hole; because EVERY USER will have to have read access to the keyfile location. So what is to stop them from copying ALL OF THEM to their own system, and doing whatever they want with them?

Think about what you're doing, and about a better way of doing it. Create a directory somewhere, that is JUST for SFTP. Then create a symlink to that directory, in everyones home directory, and chroot SFTP users to their own homes. Key management is easy, security is easy, and everyone can read/write to the one directory you're interested in.


Then you need to PAY FOR RHEL, or stop where you are and load CentOS. Not paying for RHEL is an incredibly bad move if you're going into production, because you WILL NOT get patches/security updates/bugfixes, or anything else. Your system will get insecure and unstable, pretty quick. And you won't be able to load new software as easily, since you won't have access to online repositories. Pay for RHEL, or use CentOS.
Going to try the symlink route instead.
This is a development. We will have a paid license for red hat in prod.
 
Old 04-03-2018, 07:20 AM   #8
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,650

Rep: Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970
Quote:
Originally Posted by hz36t5 View Post
Going to try the symlink route instead.
This is a development. We will have a paid license for red hat in prod.
If it's a development box, no need for RHEL at all, since CentOS is great for that. And if you're paying for RHEL in production, you can still call them for advice with such things, since you're paying for support, right?
 
Old 04-04-2018, 09:30 AM   #9
Medievalist
Member
 
Registered: Aug 2003
Distribution: Dead Rat
Posts: 191

Rep: Reputation: 56
Quote:
Originally Posted by hz36t5 View Post
I don't want them all to have the same ssh key. I want each user to continue to have a separate ssh key. I just want all of the keys in the same directory. Or, if it is possible the continue to have all of the users ssh keys in separate directories, but everyone have the same home directory. Does that make sense? At then end of the day, I want all users to log in using their ssh keys but everyone have the same home dir.
Can you explain _why_ you want to do this? If you tell us what you are trying to achieve with this scheme, we can probably give you an easier, more functional solution than sharing home folders.

To share the home folder, which is a bad idea, all your users will need the same primary group, you'll have to control access to the home folder with group permissions, (and file creation will require the sgid bit) and your ~/.ssh/authorized_keys file will need to contain the public keys of all users, and you'll want to generate the keypairs with a -C comment that names the user the private key was issued to... just for starters.
 
Old 04-04-2018, 04:39 PM   #10
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,992

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
Reported to delete thread but LQ tries to keep threads available for other readers.
 
  


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
[SOLVED] Redhat linux 6.1: Permission denied while copying a file using sftp with root user sayub76 Linux - Newbie 11 05-18-2017 03:13 AM
[SOLVED] sftp from Redhat linux to a window machine using public key authorization hat1208 Linux - Newbie 20 06-17-2015 12:41 PM
SFTP logging for Chroot on CentOS 6.2 with openssh-5.3 not working (internal-sftp) RatherBFishin Linux - Server 1 08-30-2012 06:45 PM
sftp & ftps configuration in RedHat Linux ravikiran189 Linux - Server 4 03-09-2011 12:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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