ForceCommand: starting a shell

This is a discussion on ForceCommand: starting a shell within the SSH forums, part of the Protocols category; Hi, I want to configure SSH to run "ForceCommand", and base on some configuration and if SSH_ORIGINAL_COMMAND = "" (shell), start a shell. What I found: starting ksh works, but ...

Go Back   Unix Linux Forum > Technologies & Tools > Protocols > SSH

FixUnix.com - Unix Linux Forums

Unix Content Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-26-2008, 02:11 PM
Default ForceCommand: starting a shell

Hi,

I want to configure SSH to run "ForceCommand", and base on some
configuration and if SSH_ORIGINAL_COMMAND = "" (shell), start a shell.

What I found: starting ksh works, but /etc/profile is not loaded. I
can manually . /etc/profile, but then the $HOME/.profile is not
started. I can add this one too, but what other things do I missed?

And this would work IF the shell is ksh (AIX), what if the shell is
csh, or bash? What I would like is to "pass" to shell (normal
behavior) after the script test some stuff.

My goal: use comment in the the gecos of the user that "defines" what
type of user. Depending of the "definition" (batch user, interactive
user, etc), he can or he cannot do shell, sftp, etc.

The other way would be to use "Match" directive, but that would imply
managing groups for users, which is a "big task" (decentralized
security rigth now). gecos comment is already in place.

Any help appreciated.
Reply With Quote
  #2  
Old 08-26-2008, 02:42 PM
Default Re: ForceCommand: starting a shell

estienne wrote:
> I want to configure SSH to run "ForceCommand", and base on some
> configuration and if SSH_ORIGINAL_COMMAND = "" (shell), start a shell.
>
> What I found: starting ksh works, but /etc/profile is not loaded.


You probably need to exec the shell in such a way that you pass in
an argv[0] that starts with a minus sign. That indicates to the
shell that it's being run as a login shell, which should cause it to
run .profile or .bash_profile or .login or whatever is appropriate
for that shell.
--
Simon Tatham "The distinction between the enlightened and the
terminally confused is only apparent to the latter."
Reply With Quote
Reply

Thread Tools


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

In an effort to better serve ads to our visitors, cookies are used on Fixunix.com. For more information, check out our Privacy Policy.

Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Ad Management by RedTyger