LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-06-2011, 06:12 AM   #1
Vilius
Member
 
Registered: Jan 2006
Location: Lithuania
Distribution: Arch, Debian
Posts: 193

Rep: Reputation: 16
Disallow new ssh connections for a while ?


Hello,

What is the best way to disallow new ssh connections for the duration of my session ?

I want to evade read/write collisions. Things work like that - one session put files on server, other copies these files and then deletes them. So in order to evade collision:
- I check if there are no established connections.
- Then I deny new connections temporarily.
- Do the job.
- Allow new connections again.

Maybe there are better ways to achieve the same result ?

thanks
Vilius
 
Old 01-06-2011, 06:44 AM   #2
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
You can touch /etc/nologin and put even a message in this file. Depending on your PAM setup, it will disallow new connections. To avoid locking out yourself this way when you exit accidentally, a cron-job could remove the file during night. When you are done, you can just remove the file.

It's also possible to stop/start the sshd or block port 22 in the firewall temporarily.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unauthorized SSH connections ErrorBound Linux - Security 1 03-11-2007 02:25 PM
How do I disallow ssh login by root? Seventh Linux - Newbie 1 03-26-2005 10:30 AM
disallow ssh root login only from internet wensveen Linux - Security 10 03-21-2005 07:34 AM
Can I see ssh connections? bruno buys Linux - Networking 4 11-19-2003 02:46 PM
SSH is blocking my connections tarballedtux Linux - Security 8 11-01-2002 04:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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