Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-31-2011, 05:29 AM   #1
LQ Newbie
Registered: Jan 2011
Posts: 5

Rep: Reputation: 0
Strange issue using pipes with ssh as root


has anyone seen this before, when running an ssh command as normal user via ssh i get results:

ssh picolo 'ls -d /var/sadm/pkg/* | egrep "Prod|Dev|UAT" |cut -d\/ -f5;uname -r;grep -v "^#" /opt/Tivoli/lcf/dat/1/DMXAdaptiveFileSystem.dat'>>sshnotroot
and it creates file
more sshnotroot

/ | - | - | - | - | 20 | - | -
/tmp | - | - | - | - | 20 | - | -
/opt | - | - | - | - | - | - | N
/export/opt | - | - | - | - | - | - | N

and now if i run as root (keys havebeen copied and i get directly ssh hostname /bin/ksh -t ) and it gives me root shell

root@goku$ ssh picolo 'ls -d /var/sadm/pkg/* | egrep "Prod|Dev|UAT" |cut -d\/ -f5;uname -r;grep -v "^#" /opt/Tivoli/lcf/dat/1/DMXAdaptiveFileSystem.dat'>sshwithroot
You are authorized to use this System for approved business purposes only.
Use for any other purpose is prohibited. All transactional records, reports,
e-mail, software, and other data generated by or residing upon this System
are the property of the Company and may be used by the Company for any purpose.
Authorized and unauthorized activities may be monitored.

|: No such file or directory
egrep: No such file or directory
"Prod|Dev|UAT": No such file or directory
|cut: No such file or directory
-d\/: No such file or directory
-f5;uname: No such file or directory
-r;grep: No such file or directory
-v: No such file or directory
"^#": No such file or directory

its like it is trying to ls everything... any idea what is going on?

using TectiaSSH
Old 01-31-2011, 06:11 AM   #2
Senior Member
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
Try breaking up the problem in pieces. For instance, forget about the egrep, cut, etc and try to do a simple ssh with ls/echo command as root.
You could also make ssh more verbose, so it prints more what is going wrong.
Any aliases set up for both root and non-root users?
Old 01-31-2011, 06:28 AM   #3
Registered: Mar 2010
Location: Ungheni, Rep. Moldova
Distribution: Ubuntu
Posts: 84

Rep: Reputation: 21

In the first case it logins to picolo server using user@picolo
The second one use root@picolo .

Try to ssh into the picolo server using root user without any command to see if you get any errors.
Also try to log to picolo and run : ls -d /var/sadm/pkg/* | egrep "Prod|Dev|UAT" |cut -d\/ -f5;uname -r;grep -v "^#" /opt/Tivoli/lcf/dat/1/DMXAdaptiveFileSystem.dat form the server console.

Good Luck
Old 01-31-2011, 09:36 PM   #4
LQ Newbie
Registered: Jan 2011
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks for the suggesstion chaps, but i have tried all this. I've ssh'd in debug mode even trussed the process but i cannot see any reason why it is not working for root. I wonder if it is a bug? Will keep investigating.


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
root terminal has different bash config when I ssh in vs su from another ssh account stardotstar Linux - General 4 07-01-2010 07:24 PM
[SSH] Issue logging in [SSH & Permissions] MD3 Linux - Networking 11 12-10-2006 10:25 AM
strange c issue exvor Programming 8 01-29-2005 03:23 PM
I have to ssh -l root to run root processes!? paul.nel Red Hat 3 11-15-2004 12:55 PM
ssh issue: /usr/bin/ssh -x -oFallBackToRsh no -l WeNdeL Linux - Software 1 03-04-2003 08:17 PM > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration