You are not logged in.

#1 2011-03-17 07:25:41

o1911
Member
From: Hobart, Australia
Registered: 2009-04-28
Posts: 106

[SOLVED]ssh, scp and shells

Hi all,

As always, apologies if this is not in the correct subforum.  My problem is as follows:

I have access to a server (definitely not owned by me) via ssh that is shared with hundreds of others.  Unsure of the distro and/or setup, but I am not in the /etc/passwd file, and thus cannot change my shell directly with the chsh command.  This server only has (t)csh and bash as the available shells, and defaults to csh.  I prefer to use bash, and I can get into bash immediately through ssh by putting 'exec bash' in the .cshrc file in my home dir.  This works well, as Ctrl-D logs out of ssh altogether (does not drop me back to csh) etc., however I cannot scp files from the server due to this 'exec bash' line.  To my knowledge, when scp logs into the server, it will run 'exec bash' and then sit there forever, not fetching my file.

I've searched for ways of determining that a scp session is 'logged in' rather than a normal ssh session, but to no avail, so I can't make a conditional statement in my .cshrc file.  Does anyone know a way that scp can just use csh, and ssh uses bash?  Or another way to make everyone happy.  tia

Last edited by o1911 (2011-03-17 08:49:59)


Arch x86_64

Offline

#2 2011-03-17 08:40:42

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: [SOLVED]ssh, scp and shells

try creating a .login file and put exec bash in there.
Not _super_ familiar with csh, but I *think* csh loads .login only on login shells (as apposed to always loading .cshrc).

Barring that, the following should work.

if (! $?prompt) goto cshrc_end
exec bash
cshrc_end:

"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#3 2011-03-17 08:49:43

o1911
Member
From: Hobart, Australia
Registered: 2009-04-28
Posts: 106

Re: [SOLVED]ssh, scp and shells

cactus, both solutions work, thank you very much!  I'm using the second one, as it seems to login with ssh a bit faster.


Arch x86_64

Offline

#4 2011-03-17 20:22:21

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: [SOLVED]ssh, scp and shells

Great! glad i could help.
smile

Last edited by cactus (2011-03-17 20:22:37)


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

Board footer

Powered by FluxBB