LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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
 
LinkBack Search this Thread
Old 04-04-2009, 06:54 PM   #1
yavorpap
LQ Newbie
 
Registered: Apr 2009
Posts: 2

Rep: Reputation: 0
sshd configuration help


I actually have two questions:
#1: how can I make sshd take username/password information from a database rather than the actual Linux users or a file and
#2: is there a way to reroute all commands sent through ssh so that when the user writes "X" as a command in the shell the action done on the server to be "command_handler -command X" or something like it.
As you might have guessed I want to make sshd to work as a server that only pretends to do the commands sent rather than actually doing them.
I have read that it is possible to make a command execute differently by "alias"-ing it in the shell rc file, but how can that be done to all commands?
Last, sorry if I have posted in the wrong category, I'm new here.
Thanks a lot.
 
Old 04-05-2009, 07:10 AM   #2
saman007uk
Member
 
Registered: Dec 2003
Location: ~root
Distribution: Ubuntu and Debian
Posts: 361

Rep: Reputation: 32
Quote:
#2: is there a way to reroute all commands sent through ssh so that when the user writes "X" as a command in the shell the action done on the server to be "command_handler -command X" or something like it.
As you might have guessed I want to make sshd to work as a server that only pretends to do the commands sent rather than actually doing them.
Write a script/program that takes in user commands, but doesn't do anything. Then make that the shell for those users.
 
Old 04-05-2009, 07:50 AM   #3
tronayne
Senior Member
 
Registered: Oct 2003
Location: Michigan
Distribution: Slackware 32- & 64-bit Stable
Posts: 1,826

Rep: Reputation: 359Reputation: 359Reputation: 359Reputation: 359
When you generate the public and private key information with ssh-keygen they're stored in your home directory's .ssh sub-directory; those are your "data base." A user on a different server would do the same thing, generating pubic and private keys on a remote machine. Let's say that both you and the other user generated keys with the default RSA authentication so there would be, on both machines, id_rsa and id_rsa.pub files in the ${HOME}/.ssh directories.

The remote user would connect to your server with
Code:
ssh -l username servername
and would be prompted for a password and logged in on your machine as "username."

Now, how to avoid that is pretty simple but is a little confusing the first time out. What you do is copy the id_rsa.pub file from the remove machine to your machine's ${HOME}/.ssh directory to a file named authorized_keys (you can do this with scp)
Code:
cd .ssh
scp remote:/home/.ssh/id_rsa.pub remote
cat remote >> authorized_keys
You use "remote" (the name of the server) so you don't overwrite your own id_rsa.pub file (and if you've got a bunch of remote servers to do, it's handy to have the public files in server-named files so you don't lose track).

You do the same thing on the remote machine, copying "your" id_rsa.pub file to it and adding that to the authorized_keys file there. Do not copy the id_rsa private key file to any other machine; keys are generated on the server for that sever.

Once you've done that, "you" and "remote" can connect without a password prompt.

Repeat the above for every remote server; i.e., "their" id_rsa.pub file copied into "your" authorized_keys file, "your" id_rsa.pub file copied to "their" authorized_keys file.

You can take things one step further if you create a config file in the .ssh directories. Let's say that my machine, fubar, connects to a remote machine, snafu, and I want to run applications on snafu. My config file would look like this
Code:
Host snauf
ForwardX11 yes
Compression yes
Protocol 2,1
User my-user-name

Host *
ForwardX11 no
and, the revers on snafu to get to my machine. Once this done, a remote user simply enters
Code:
ssh fubar
and is connected as "User" (which, of course, does not have to be their log id on their machine, but does have to be the id on this machine).

You might take a look at http://www.linuxjournal.com/article/6602 for some additional information and explanation that may be useful.

Hope this helps some.
 
Old 04-05-2009, 04:31 PM   #4
yavorpap
LQ Newbie
 
Registered: Apr 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks for the replies
 
  


Reply

Tags
config, ssh, sshd


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Starting sshd: /etc/init.d/sshd: line 113: /usr/sbin/sshd: Permission denied sumanc Linux - Server 5 03-28-2008 04:59 AM
SSHD Configuration Problems brabbit Slackware 12 12-17-2007 10:08 AM
sshd configuration sang_froid Linux - Server 2 07-25-2007 12:29 AM
security sshd with better file configuration huanvnn Linux - Security 5 06-04-2006 05:36 AM
sshd configuration glock19 Linux - General 13 04-25-2002 03:31 PM


All times are GMT -5. The time now is 09:55 AM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration