LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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


Reply
  Search this Thread
Old 01-20-2024, 01:53 AM   #1
Jason.nix
Member
 
Registered: Feb 2023
Posts: 561

Rep: Reputation: 10
Post Different SSHs


Hello,
Is the SSH configuration file different for each user?
I want to have two SSH users. One of them can have two sessions at the same time and one can have only one session. Is this possible?

Thank you.
 
Old 01-20-2024, 02:35 AM   #2
lvm_
Member
 
Registered: Jul 2020
Posts: 927

Rep: Reputation: 337Reputation: 337Reputation: 337Reputation: 337
It can be done but not via sshd configuration. man limits.conf, man pam_limits
 
1 members found this post helpful.
Old 01-20-2024, 02:56 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,855

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
you might even start 2 different ssh servers with different configs.
 
Old 01-20-2024, 03:29 AM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,310
Blog Entries: 3

Rep: Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722
Quote:
Originally Posted by Jason.nix View Post
Is the SSH configuration file different for each user?
I want to have two SSH users. One of them can have two sessions at the same time and one can have only one session. Is this possible?
Yes, it can be different for each user if you set that with the Match directive. When combined with the MaxSessions directive you can limit the number of concurrent remote logins. However, keep in mind that there are a great many ways to circumvent that once they are logged in. For example, with shell access they could log in and run tmux or screen and thus have multiple interactive sessions via a single SSH session.

What problem are you trying to solve?
 
Old 01-20-2024, 09:47 AM   #5
replica9000
Senior Member
 
Registered: Jul 2006
Distribution: Debian Unstable
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 260Reputation: 260Reputation: 260
You can add this to the user's ~/.ssh/config if you want to limit them to one connection if they open more than one session
Code:
Host *
   ControlMaster auto
   ControlPath ~/.ssh/sockets/%r@%h-%p
   ControlPersist 600
ControlPath can by anything, but the directory has to exist before hand. SSH won't create it on its own.
 
1 members found this post helpful.
Old 01-21-2024, 12:53 AM   #6
Jason.nix
Member
 
Registered: Feb 2023
Posts: 561

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by lvm_ View Post
It can be done but not via sshd configuration. man limits.conf, man pam_limits
Hello,
Thank you so much for your reply.
The syntax is:
Code:
<Username> <type> <item> <value>
I found some interesting fields for <item>:
Code:
     core
         limits the core file size (KB)

     data
         maximum data size (KB)

     fsize
         maximum filesize (KB)

     memlock
         maximum locked-in-memory address space (KB)

     stack
        maximum stack size (KB)

     cpu
        maximum CPU time (minutes)
Can I limit the amount of RAM and CPU usage for the user?
 
Old 01-21-2024, 01:43 AM   #7
lvm_
Member
 
Registered: Jul 2020
Posts: 927

Rep: Reputation: 337Reputation: 337Reputation: 337Reputation: 337
Quote:
Originally Posted by Jason.nix View Post
Can I limit the amount of RAM and CPU usage for the user?
As far as CPU and RAM usage are concerned pam_limits controls per process usage, not a per user one. You should use cgroups for that.
 
1 members found this post helpful.
Old 01-21-2024, 04:47 AM   #8
Jason.nix
Member
 
Registered: Feb 2023
Posts: 561

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by lvm_ View Post
As far as CPU and RAM usage are concerned pam_limits controls per process usage, not a per user one. You should use cgroups for that.
Hello,
Thank you so much.
 
  


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
A tale of two SSHs dgermann Linux - Networking 10 08-12-2015 11:07 PM
different desktops for different apps? cpv204 Linux - Newbie 7 03-25-2003 08:32 AM
different umask for different user macgyver Linux - Security 6 04-17-2002 11:33 AM
different distros, different packages gors Linux - Newbie 3 01-17-2002 12:37 PM
Amazon charging different prices for different customers! jeremy General 4 10-19-2000 03:25 PM

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

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