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 - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-02-2014, 06:34 PM   #1
muruguc
LQ Newbie
 
Registered: Jan 2014
Posts: 2

Rep: Reputation: Disabled
Direct SSH root login blocked but I want to run specific command in my network


I am writing a script to run a specific command from one server to all other servers in a network. If SSH direct root is enabled then I am able to get the output but in my network we blocked direct SSH root access so my script is not giving output.

One option is we can create a new user and give sudo permission to run a specific command but creating a user account is a big process in our office.

Can you guys please suggest some other way to fix this.....
 
Old 05-02-2014, 07:20 PM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
depending on the version of the distro and the version of openssh, maybe there is an exploit you can take advantage of that hasnt been patched yet ?

maybe you can log in as root and open a listening port using netcat so that when it receives a certain string it will run a certain command.

Last edited by schneidz; 05-02-2014 at 07:22 PM.
 
Old 05-03-2014, 03:07 AM   #3
muruguc
LQ Newbie
 
Registered: Jan 2014
Posts: 2

Original Poster
Rep: Reputation: Disabled
All the servers are done with the patch and those servers are more secure....
 
Old 05-03-2014, 07:03 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by schneidz View Post
depending on the version of the distro and the version of openssh, maybe there is an exploit you can take advantage of that hasnt been patched yet ?
I hope that's a joke and not the kind of sound technical advice we would like LQ to be known for?


Quote:
Originally Posted by schneidz View Post
maybe you can log in as root and open a listening port using netcat so that when it receives a certain string it will run a certain command.
Isn't that basically telling the OP to create a backdoor w/o any authentication?..


Quote:
Originally Posted by muruguc View Post
I am writing a script to run a specific command from one server to all other servers in a network.
Wheel reinvention-wise there's OTS tools dealing with ^whatever.on.*multiple hosts already like ClusterSSH, Dsh, Fanout / Fanterm, Tentakel, Shocto, SwitchTower, MUC, Parallel SSH and RGANG.


Quote:
Originally Posted by muruguc View Post
If SSH direct root is enabled then I am able to get the output but in my network we blocked direct SSH root access so my script is not giving output.
Good!


Quote:
Originally Posted by muruguc View Post
creating a user account is a big process in our office.
I'm sorry but that isn't a technical problem.


Quote:
Originally Posted by muruguc View Post
Can you guys please suggest some other way to fix this.....
It depends on what your "specific command" is supposed to do (why don't you tell us?) and what flexibility you need. For example if it is only about passive system information gathering then you could look into SNMP (do using version 2 or 3 and set a read-only community) or even a Xinetd-based script.
 
1 members found this post helpful.
Old 05-03-2014, 09:10 AM   #5
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
Quote:
Originally Posted by muruguc View Post
Can you guys please suggest some other way to fix this.....
Quote:
Originally Posted by unSpawn View Post
I hope that's a joke and not the kind of sound technical advice we would like LQ to be known for?
yeah, kinda' my lame tongue-in-ckeek attempt to help the op consider that what s/he is trying to fix mite be fairly ludicrous (they are essentially asking for a way to circumvent security that they put in place). without proper authorization s/he would have to hack their way thru.

i only heard of a few of the programs you listed above (i assumed root would be necessary to access the resources they wanted but possibly not) ... methinks i souldve left this untouched as a 0 reply thread.

Last edited by schneidz; 05-03-2014 at 09:24 AM.
 
Old 05-03-2014, 10:33 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by schneidz View Post
yeah, kinda' my lame tongue-in-ckeek attempt to help the op consider that what s/he is trying to fix mite be fairly ludicrous (they are essentially asking for a way to circumvent security that they put in place). without proper authorization s/he would have to hack their way thru.
Ah, OK. I see. Next time an overabundance of smilies might help :-]


Quote:
Originally Posted by schneidz View Post
i only heard of a few of the programs you listed above (i assumed root would be necessary to access the resources they wanted but possibly not) ... methinks i souldve left this untouched as a 0 reply thread.
Hell no, it was constructive, so feel free to post...
 
Old 05-03-2014, 06:35 PM   #7
Beryllos
Member
 
Registered: Apr 2013
Location: Massachusetts
Distribution: Debian
Posts: 529

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
What if you allow ssh to root with a forced command?
http://oreilly.com/catalog/sshtdg/ch...h08.html#22858
Assuming you do it right, can that be as secure as blocking all ssh root access?
 
Old 05-05-2014, 09:01 PM   #8
wstewart90
Member
 
Registered: May 2013
Distribution: Arch Linux
Posts: 86

Rep: Reputation: Disabled
Create a user and allow sudo nopasswd access to just the one command you want to run. That's what sudo is for. You could also have a cron script run and then email the output or save it to a file that you can cat after logging into the server but that all depends on what the command is really supposed to do.

Last edited by wstewart90; 05-05-2014 at 09:05 PM.
 
Old 05-06-2014, 08:15 AM   #9
bloodstreetboy
Member
 
Registered: May 2012
Posts: 201
Blog Entries: 3

Rep: Reputation: 37
Quote:
Originally Posted by muruguc View Post
I am writing a script to run a specific command from one server to all other servers in a network. If SSH direct root is enabled then I am able to get the output but in my network we blocked direct SSH root access so my script is not giving output.
One option is we can create a new user and give sudo permission to run a specific command but creating a user account is a big process in our office.
Can you guys please suggest some other way to fix this.....
Give sudo permission to already created user if creating new user is a lengthy process.
 
  


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] Direct root login via ssh EngnrRG Linux - Security 16 05-18-2011 10:30 PM
How to prohibit direct root login (ssh or console) Hiroshi Linux - Security 9 08-25-2010 01:58 PM
would like to disable direct root login using ssh/sftp rholme Linux - Newbie 4 05-17-2008 07:12 PM
run a specific script with root privilege as any user(possibly with ssh) z940303 Programming 5 09-05-2007 08:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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