SSH executes the command differently

0

1

After several experiments I got to a surprising behavior by SSH. I usually access to a specific application through an SSH connection. In fact, that app is on a virtual-box on a workstation in a LAB. I use my laptop to connect to the app through ssh. The connection between virtual-box which provides ubuntu as the guest OS and workstation (which is ubuntu also) is defined by Bridging.

My other method of connection to the workstation and app is through Teamviewer. Anyway, the fact is that when I run a specific command, which is execution of a make file,through TeamViewer (Remote Desktop) everything is fine and that command returns successfully, It is equal to the situation that someone runs the app locally. But when I get to the app through SSH, the "make command" ends with several errors. It is strange that the same command has different results when it is executed through different methods!

Could you please help me how to deal with this problem. I am more comfortable to work with the shell by ssh not by teamviewer due to high bandwidth usage and delays on passing commands. To provide you with more details output of "env" command in both environments (SSH and Teamviewer) are as follows:

LC_PAPER=it_IT.UTF-8
XDG_SESSION_ID=7
LC_ADDRESS=it_IT.UTF-8
LC_MONETARY=it_IT.UTF-8
TERM=xterm-256color
SHELL=/bin/bash
ALTERAOCLSDKROOT=/home/legup/altera/15.0/hld
SSH_CLIENT=10.48.44.137 35604 22
LC_NUMERIC=it_IT.UTF-8
QSYS_ROOTDIR=/home/legup/altera/15.0/quartus/sopc_builder/bin
SSH_TTY=/dev/pts/10
USER=legup
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
LC_TELEPHONE=it_IT.UTF-8
QUARTUS_ROOTDIR=/home/legup/altera/15.0/quartus/
MAIL=/var/mail/legup
PATH=/home/legup/legup-4.0/gui/scheduleviewer:/home/legup/clang+llvm-3.5.0-x86_64-linux-gnu/bin:/home/legup/altera/15.0/modelsim_ase/bin:/home/legup/altera/15.0/quartus/sopc_builder/bin:/home/legup/altera/15.0/quartus/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
QT_QPA_PLATFORMTHEME=appmenu-qt5
LC_IDENTIFICATION=it_IT.UTF-8
PWD=/home/legup/legup-4.0
LANG=en_CA.UTF-8
LC_MEASUREMENT=it_IT.UTF-8
LEGUP_EXAMPLES=/home/legup/legup-4.0/examples
QUARTUS_64BIT=1
SHLVL=1
HOME=/home/legup
LANGUAGE=en_CA:en
LOGNAME=legup
SSH_CONNECTION=10.48.44.137 35604 10.79.4.173 22
LESSOPEN=| /usr/bin/lesspipe %s
XDG_RUNTIME_DIR=/run/user/1000
LESSCLOSE=/usr/bin/lesspipe %s %s
LC_TIME=it_IT.UTF-8
LC_NAME=it_IT.UTF-8
_=/usr/bin/env
OLDPWD=/home/legup

XDG_VTNR=7
XDG_SESSION_ID=c1
CLUTTER_IM_MODULE=xim
SELINUX_INIT=YES
XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/legup
SESSION=ubuntu
GPG_AGENT_INFO=/run/user/1000/keyring-A53H7K/gpg:0:1
TERM=xterm
SHELL=/bin/bash
XDG_MENU_PREFIX=gnome-
VTE_VERSION=3409
ALTERAOCLSDKROOT=/home/legup/altera/15.0/hld
WINDOWID=69206027
OLDPWD=/home/legup/legup-4.0/examples
UPSTART_SESSION=unix:abstract=/com/ubuntu/upstart-session/1000/1362
QSYS_ROOTDIR=/home/legup/altera/15.0/quartus/sopc_builder/bin
GNOME_KEYRING_CONTROL=/run/user/1000/keyring-A53H7K
GTK_MODULES=overlay-scrollbar:unity-gtk-module
USER=legup
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
SSH_AUTH_SOCK=/run/user/1000/keyring-A53H7K/ssh
DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path
SESSION_MANAGER=local/legup-vm:@/tmp/.ICE-unix/1665,unix/legup-vm:/tmp/.ICE-unix/1665
XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg
QUARTUS_ROOTDIR=/home/legup/altera/15.0/quartus/
PATH=/home/legup/legup-4.0/gui/scheduleviewer:/home/legup/clang+llvm-3.5.0-x86_64-linux-gnu/bin:/home/legup/altera/15.0/modelsim_ase/bin:/home/legup/altera/15.0/quartus/sopc_builder/bin:/home/legup/altera/15.0/quartus/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
DESKTOP_SESSION=ubuntu
QT_IM_MODULE=ibus
QT_QPA_PLATFORMTHEME=appmenu-qt5
JOB=dbus
PWD=/home/legup/legup-4.0/examples/matrixmultiply
XMODIFIERS=@im=ibus
GNOME_KEYRING_PID=1605
LANG=en_CA.UTF-8
GDM_LANG=en_CA
MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path
LEGUP_EXAMPLES=/home/legup/legup-4.0/examples
QUARTUS_64BIT=1
IM_CONFIG_PHASE=1
COMPIZ_CONFIG_PROFILE=ubuntu
GDMSESSION=ubuntu
SESSIONTYPE=gnome-session
XDG_SEAT=seat0
HOME=/home/legup
SHLVL=1
LANGUAGE=en_CA:en
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
LOGNAME=legup
COMPIZ_BIN_PATH=/usr/bin/
XDG_DATA_DIRS=/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/
QT4_IM_MODULE=xim
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-fzhVmN3W5R
LESSOPEN=| /usr/bin/lesspipe %s
INSTANCE=
TEXTDOMAIN=im-config
XDG_RUNTIME_DIR=/run/user/1000
DISPLAY=:0
XDG_CURRENT_DESKTOP=Unity
GTK_IM_MODULE=ibus
LESSCLOSE=/usr/bin/lesspipe %s %s
TEXTDOMAINDIR=/usr/share/locale/
COLORTERM=gnome-terminal
XAUTHORITY=/home/legup/.Xauthority
_=/usr/bin/env

Ouput of makefile when executed by ssh

Puya Amiri

Posted 2016-06-04T20:10:38.157

Reputation: 13

The question is why my command returns different outputs using either ssh or teamviewer. The command is "make hybrid" it is a make command for an app called Legup which is about high level synthesis. The methods are SSH or Opening the terminal using TeamViewer. The command ends with many errors when it is executed by ssh. – Puya Amiri – 2016-06-04T21:02:07.923

i'm sure this is over my head but anyhow, you could explain further, maybe somebody will know. first, is it a command line application? Are you able to state the application that it is? Can you show the ssh command that you use to login and to execute the application(e.g. that way we can see if you're using -X, or just regular)? I haven't used -X but i've seen a friend do it and it kind of launches remote gui programs locally. Without that, I think ssh can only load command line programs. – barlop – 2016-06-04T21:16:58.140

@barlop yes it is just a command line application. I log in this way: ssh legup@10.79.4.173 then I go to the directory of application and type in: "make hybrid", I put the result of this command at the end of question body. I don't use -X11 or similar methods.. just ssh based on command line. – Puya Amiri – 2016-06-04T21:42:36.460

1who are you logged in as if you go in with teamviewer then open a terminal window? e.g. do cd ~/ from a terminal after logging in via teamviewer and see who the user is, and contrast that with when going in with ssh – barlop – 2016-06-04T21:44:50.017

also you could also additionally ask the question to the developers of the program and B)I wonder if anybody ever wrote a server program that provides a terminal to the client that connects to it, and then sends the commands onto a terminal on the remote machine. – barlop – 2016-06-04T22:42:23.183

@barlop The procedure that you explained is not something new. Many Geeks ;-) are using this method to run their program. By the way, thank you for your help, I found the solution, take a look at the answer I posted below – Puya Amiri – 2016-06-05T14:31:46.833

You claim that the method I described that I said might not exist, of "a server program that provides a terminal to the client that connects to it, and then sends the commands onto a terminal on the remote machine" is used by many geeks. No it is not.Do u realise that when u use SSH (which is probably what you mean), it logs in itself. Do u understand i'm not taking about that.I'm talking about one that doesn't log in but that uses a terminal on the already logged in machine. (And under that system you wouldn't have the problem would you 'cos the environment would be as it is on teamviewer) – barlop – 2016-06-05T16:10:18.887

@barlop I might have misunderstood your scenario. yes, ssh need to be logged in and I do it. Your scenario can be implemented also but not using the regular settings of linux kernel due to authorisation problems. but for example in case of embedded systems there are some methods to talk to the firmware without strict authorisations. Anyway, we are here to learn from each other if I or you don't understand sth we can help each other. Don't feel offended :-) – Puya Amiri – 2016-06-05T18:26:44.897

Let us continue this discussion in chat.

– barlop – 2016-06-05T20:18:52.830

Answers

1

This question was answered thoroughly by @Jakuje at askubuntu section.

In concise, ssh is passing LC_* environmental variables through in default installations so when there is no consistency between local and ssh environments considering the locale variables, this problem happens. The solution addressed in details here

Puya Amiri

Posted 2016-06-04T20:10:38.157

Reputation: 13