Remote commands fail for tcsh user


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Remote commands fail for tcsh user
# 1  
Old 10-04-2010
Remote commands fail for tcsh user

I'm more familiar with bash/ksh that csh/tcsh. With that said, I recently ran across a problem with tcsh.

Our system admin recently installed purify on our solaris 8 system. In order to use purify you have to execute a Rational script in order to setup the paths and some environment variables correctly. Since we only have a single license for purify, our admin setup the license for a single "common" user account that the developers could use. This common user account happens to be defined to use tcsh as its default login shell.

Our system admin went on to add a 'source' command to the .tcshrc login file for this common user so the Rational script would automatically get executed upon logging in.

At this point everything seems to work just fine. However, it was later discovered that commands from a remote host to the user of the host upon which purify was installed no longer work. Commands like ssh, scp, and rsync.

After a bunch of experimenting, I was able to track this problem down to some output statements (in particular, 'echo') within the Rational script. An example would be... let's say you execute an scp command on a remote host to copy some files from the user on the system for which purify was setup. You actually see the output from the echo commands within the Rational script, but then scp will finish without performing the copy.

Instead of modifying the third party Rational script, I decided to mess around with the .tcshrc login file. Since I'm not that familiar with the tcsh shell, the first thing I tried was to simply redirect the output of the sourced Rational script a multitude of different ways, none of which worked. Here's an example of one attempt.

source /Rational/purifyplus_setup.csh > /dev/null

Eventually I stumbled across a solution by checking the TERM environment variable prior to executing the Rational script. The script will only execute if TERM exists.

This brings me to my questions...

1. Why would output statements cause remote commands to fail?

2. Why does redirecting the output not work? In fact, redirecting the output did absolutely nothing. You still see the output.

3. Is there a better solution than checking the TERM environment variable? I don't know if doing such a check will cause some other login or remote login senario to fail.
# 2  
Old 10-04-2010
Quote:
Originally Posted by sszd
1. Why would output statements cause remote commands to fail?
I can't tell without seeing the script.
Quote:
2. Why does redirecting the output not work? In fact, redirecting the output did absolutely nothing. You still see the output.
Did you try redirecting stderr, too? or just stdout?
Quote:
[COLOR=red]3. Is there a better solution than checking the TERM environment variable? I don't know if doing such a check will cause some other login or remote login senario to fail.
Depends what you're trying to do, which is not clear at this point.
# 3  
Old 10-04-2010
Quote:
Originally Posted by Corona688
I can't tell without seeing the script.
Which script, the Rational script or the .tcshrc login script? I'm afraid I cannot get the scripts off of the system they're on as it's a classified system. However, if it's the Rational script you're interested in, here's a real simple test you can try which I've done to duplicate this problem in a very simple form.

1. Create a script, say abc, with the following...

echo hello
set xyz=aaa

2. At the bottom of your .tcshrc login file enter the following...

source abc

3. Now login and make sure you see the output from your echo, and then check your xyz environment variable to make sure it's set. If everything works up to this point, proceed with the next step.

4. Get on a remote host, or you can actually try this from the same host if you wish, but as a different user. Execute the following command.

$ scp -pr user@hostname:filename ~/.

...where user is the user you set up your abc script above and modified your .tcshrc file. hostname is the name of the host for the same user. filename can be any file you want to copy from that users account. When you execute this command you should observe that the echo from your script is still being output, but no file will get copied. Why???

5. Now add some redirects to your sourced abc script within your .tcshrc file. Try this for example...

source abc > /dev/null

6. Perform step 4 again. You should observe the output from the echo command still being shown. Why???

This should duplicate the kind of problem I'm experiencing.

Quote:
Originally Posted by Corona688
Did you try redirecting stderr, too? or just stdout?
I believe so. Like I said, I'm not that familiar with tcsh. According to the man pages for tcsh it says... "The shell cannot presently redirect diagnostic output without also redirecting standard output...", so I tried this...

source /Rational/purifyplus_setup.csh >& /dev/null

This also did nothing. Output was still visable. There was a bunch of other syntaxes I tried as well, but I can't remember all of them now.

Quote:
Originally Posted by Corona688
Depends what you're trying to do, which is not clear at this point.
We're simply trying to get the Rational script to execute upon login so the paths are automatically setup correctly (which already works), and at the same time get remote commands to successfully execute (which doesn't work, unless you do what I've already mentioned in my original post, upon which I still have my question of concern in #3).
# 4  
Old 10-05-2010
Does anyone have any answers or ideas regarding my questions in the original post?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need Help ssh key fail on remote server

Hello everyone, I need some help writing a bash script to: 1. ssh from a jumpserver to 50 remote servers logging in automatically using ssh keys and capture if zabbix is running by running a "ps -ef | grep zabbix" and output to a logfile capturing the server hostname and ps -ef output to... (2 Replies)
Discussion started by: vtowntechy
2 Replies

2. Shell Programming and Scripting

Piping to user application sometimes fail

Hi, currently, I have a problem in a stress test bash script. i´m using the following command: while true; do echo $"command" | ./myprogram; sleep 0.4; done --> myprogram is watching for stdin via select The problem is that it will work a couple of times. After that, the stdin fd... (3 Replies)
Discussion started by: bertl100
3 Replies

3. Solaris

Remote Ssh Fail

Hi, I'm getting error when try to remote using ssh. I already check and ssh service is online. Does solaris 11 sparc need to do other setting. Error is interactive keyboard failed. Please assist me. Thanks. ---------- Post updated at 10:25 PM ---------- Previous update was at 08:49 PM... (0 Replies)
Discussion started by: mzainal
0 Replies

4. Shell Programming and Scripting

sed commands success / fail from commandline vs ksh script

solaris 5.10 Generic_138888-03 sun4v sparc SUNW,Sun-Fire-T200 I need a sed command that tests true when presented with lines that contain either forward and backslash. input file: c:/myFile.txt c:\yourFile.txt It doesn't appear that sed (in my environment anyway) supports... (4 Replies)
Discussion started by: msutfin
4 Replies

5. Shell Programming and Scripting

Running commands in remote node as root user

Platform :Oracle Linux 6.4 We are trying to automate the SAN level cloning from production RAC DB cluster to test. From a shell script, I would like to run the below command Step1,2 and 3 from Node1 in a sequential order as root user . How can I do this ? passwordless for root user is not... (2 Replies)
Discussion started by: kraljic
2 Replies

6. Red Hat

RHEL6 Diskless Remote boot fail

Hi guys, I've been trying to set up a server for disk-less booting of remote machines on a network. The server host OS is RHEL6 and I have configured dhcp, tftp and nfs services which are proven to be working since I am able to install RHEL6 through pxe boot. Now I want it to serve for disk-less... (0 Replies)
Discussion started by: aninmuk
0 Replies

7. Shell Programming and Scripting

TCSH user input checks

I would like to check user input for arguments 1 and 2 for my Solaris TCSH script for the following: 1. That both user input arguments are numbers. 2. That they are both at least 5 digits. Thanks for the help. (1 Reply)
Discussion started by: thibodc
1 Replies

8. Shell Programming and Scripting

how to prompt the user to enter an array in tcsh

Hello, I am writing a script that requires the user to enter a string of numbers: ex: 134 345 865 903 This command only allows for one variable to be entered: set "var" = $< and than once I got the array I want to change it to a list with each input on a different line: ... (1 Reply)
Discussion started by: smarones
1 Replies

9. Shell Programming and Scripting

tcsh and user input

Here is my script: echo "var 1:" read varone echo "$varone" When I run in via ksh the script runs successfully. However when I run it via tcsh I get "varone: Undefine variable" Does the name command not work with tcsh or do I need some additional modification? Is there a way to get... (1 Reply)
Discussion started by: bonesy
1 Replies

10. Shell Programming and Scripting

Can BASH execute commands on a remote server when the commands are embedded in shell

I want to log into a remote server transfer over a new config and then backup the existing config, replace with the new config. I am not sure if I can do this with BASH scripting. I have set up password less login by adding my public key to authorized_keys file, it works. I am a little... (1 Reply)
Discussion started by: bash_in_my_head
1 Replies
Login or Register to Ask a Question