1

i want to limit the ssh tunneling per user I did create a user with only ssh tunneling permission ( no shell, no directory ) now I want to limit this user not be able to connect multi devices simultaneously to this tunnel ( I don't want to bind device's mac address to the user since they might change their device or firewall things ). does changing the user maxlogin on /etc/security/limits affect ssh tunneling limits?

1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Commented Jan 31, 2023 at 16:22

1 Answer 1

2

Yes, it does, example below.

The post How can I disconnect ssh users, or limit the number of ssh logins? has this in an answer by Dmitry Alexeyev:

Setting up maxlogins limit actually works here. Just make sure you use '-' limit type, not 'hard'.

user1          -       maxlogins       1

Note that the post demanded a method for preventing more than one user to connect to the tunnel at a time, and the answer was by setting maxlogins to 1 for both users.

6
  • so this is wrong? user1 hard maxlogins 1
    – DIC3
    Commented Jan 31, 2023 at 18:16
  • Wrong ? It's supposed to work as you want. The user can only connect once.
    – harrymc
    Commented Jan 31, 2023 at 18:16
  • check this please pastebin.com/YfRb37Cb
    – DIC3
    Commented Jan 31, 2023 at 18:22
  • The line you added is not exactly as in my answer.
    – harrymc
    Commented Jan 31, 2023 at 18:25
  • i still can connect with 3 I did add this : user1 - maxlogins 1 and restart the ssh&reboot. are you sure this work for tunneling?
    – DIC3
    Commented Jan 31, 2023 at 19:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .