1

CentOSv5.5 2.6.18-194.32.1.el5
Как можно организовать терминальный доступ через удаленную сессию ssh?
По статье http://www.lintest.ru/wiki/%D0%A2%D0%B5 … 8Ubuntu%29
запускаю

 Консоль:
   $ xinit /usr/bin/ssh -X user@host gnome-session -- :1

где user@host обозначает: user – имя пользователя на удаленной машине, host – IP удаленного компьютера.

В итоге ничего не показывает, кроме серого поля и крестика и xterm-а нет!

Подскажите, может что-то еще дописать надо? Что не так?  ac

2

а сам Gnome-то установлен?

3

Разве недостаточно просто ssh -X user@host, и в полученной консоли запускать нужные приложения (в том числе и иксовые)? Или ты хочешь полноценный удалённый рабочий стол получить?

4

Gnome установлен!
Разве недостаточно просто ssh -X user@host   -->> не достаточно раз спрашиваю)

5 (11.05.2011 14:28:52 отредактировано katux)

ау... неужели никто не настраивал удаленный раб стол??? ac

6

Значит ни кто так не делал. Попробуй VNC, обычно с ним связаны все вопросы по удалённому рабочему столу.

7 (11.05.2011 14:48:57 отредактировано i2ks)

katux пишет:

ау... неужели никто не настраивал удаленный раб стол??? sad

вообще работает. но внутри локальной сети:

вот часть, то что в консоли выдало:

> xinit /usr/bin/ssh -X useradm@192.168.0.31 gnome-session -- :1


X.Org X Server 1.8.0
Release Date: 2010-04-02
X Protocol Version 11, Revision 0
Build Operating System: openSUSE SUSE LINUX
Current Operating System: Linux sysadminpc 2.6.34.8-0.2-desktop #1 SMP PREEMPT 2011-04-06 18:11:26 +0200 i686
Kernel command line: root=/dev/disk/by-id/ata-ST3320613AS_9SZ60LW8-part6 resume=/dev/disk/by-id/ata-ST3320613AS_9SZ60LW8-part5 splash=silent quiet vga=0x31a
Build Date: 19 August 2010  03:34:17PM
 
Current version of pixman: 0.18.0
    Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.1.log", Time: Wed May 11 14:45:16 2011
(==) Using config directory: "/etc/X11/xorg.conf.d"
(EE) No input driver/identifier specified (ignoring)
(EE) No input driver/identifier specified (ignoring)
Warning: No xauth data; using fake authentication data for X11 forwarding.
/usr/bin/xauth:  creating new authority file /home/useradm/.Xauthority
gnome-session[8823]: WARNING: Unable to determine session: Unable to lookup session information for process '8823'
gnome-session[8823]: WARNING: Could not parse desktop file /etc/xdg/autostart/ksmolt-autostart.desktop: Недопустимое имя ключа: X-KDE-autostart-condition[$e]
gnome-session[8823]: WARNING: could not read /etc/xdg/autostart/ksmolt-autostart.desktop
GNOME_KEYRING_CONTROL=/tmp/keyring-8AbvSf
SSH_AUTH_SOCK=/tmp/keyring-8AbvSf/ssh
GNOME_KEYRING_PID=8864
GNOME_KEYRING_CONTROL=/tmp/keyring-8AbvSf
SSH_AUTH_SOCK=/tmp/keyring-8AbvSf/ssh
GNOME_KEYRING_CONTROL=/tmp/keyring-8AbvSf
SSH_AUTH_SOCK=/tmp/keyring-8AbvSf/ssh

** (gnome-settings-daemon:8867): WARNING **: Can not run apport-checkreports
....
It is good day to die ...
MS Windows 10
Заметки о главном...

8

katux, на удаленном хосте выполните:  ps -ef|grep gnome-session

It is good day to die ...
MS Windows 10
Заметки о главном...

9

Vascom пишет:

Значит ни кто так не делал. Попробуй VNC, обычно с ним связаны все вопросы по удалённому рабочему столу.

пробую VNC. только на удаленном хосте по htop видно что запускаемое приложение (например, bacula admin tools) хавает много ресурсов!
подсказали использовать как раз терминальный доступ через ssh

10

i2ks пишет:
katux пишет:

ау... неужели никто не настраивал удаленный раб стол??? sad

вообще работает. но внутри локальной сети:

внутри локалки и надо)

11 (11.05.2011 16:36:40 отредактировано katux)

i2ks пишет:

katux, на удаленном хосте выполните:  ps -ef|grep gnome-session

на своей машинке в локалке запускаю:

 Консоль:
$ xinit /usr/bin/ssh -X katod@server1.testdomain.local gnome-session -- :1

на той машинке удаленной:

 Консоль:
~]# ps -ef | grep gnome-session
katod  2292  2134  0 Apr19 ?        00:00:00 /usr/bin/gnome-session
root      5371  4397  0 16:09 pts/2    00:00:00 grep gnome-session
~]#

Значит работает! Только вот серый экран и курсорчик..... (на всех консолях переключая Ctrl+Alt+F1 и F8)
Только меня дата смутила..... 19 апреля! а сейчас 11 мая  :o

12

katux,

katux пишет:

Только вот серый экран и курсорчик..... (на всех консолях переключая Ctrl+Alt+F1 и F8)

а в лог что нибудь сыпется?

It is good day to die ...
MS Windows 10
Заметки о главном...

13

почитай еще вот это: http://www.senyk.poltava.ua/projs/books … xt8_8.html  smile

It is good day to die ...
MS Windows 10
Заметки о главном...

14

Те же симптомы были с клиентом vnc при неправильной настройке .xstartup - надо было на клиенте раскомментировать строки: 

 Консоль:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

Возможно подобный конфиг есть и у ssh - проверить точно нет пока возможности.

Не иди по течению, не иди против течения - иди поперек течения, если хочешь достигнуть берега.
Открой сердце

15 (12.05.2011 09:59:32 отредактировано katux)

СПАСИБО БОЛЬШОЕ всем за помощь!!!
Отвечаю попорядку:
из http://www.senyk.poltava.ua/projs/books … xt8_8.html   следует, что

 Консоль:
~]# netstat -ap | grep xdm
~]#

не работает! но при этом постоянно висит это:

 Консоль:
~]# ps -ef|grep gnome-session
katod  2292  2134  0 Apr19 ?        00:00:00 /usr/bin/gnome-session
root      8577  8546  0 09:44 pts/2    00:00:00 grep gnome-session
~]#

Похоже что у меня как раз-таки "В противном случае сервер просто не обрабатывает запросы по протоколу XDMCP или менеджер дисплея не запущен".

16

 Консоль:
ssh]# ls -l
итого 204
-rw------- 1 root root 132839 Сен 12  2010 moduli
-rw-r--r-- 1 root root   1827 Сен 12  2010 ssh_config
-rw------- 1 root root   3323 Сен 12  2010 sshd_config
-rw------- 1 root root    672 Ноя 17 08:09 ssh_host_dsa_key
-rw-r--r-- 1 root root    590 Ноя 17 08:09 ssh_host_dsa_key.pub
-rw------- 1 root root    963 Ноя 17 08:09 ssh_host_key
-rw-r--r-- 1 root root    627 Ноя 17 08:09 ssh_host_key.pub
-rw------- 1 root root   1675 Ноя 17 08:09 ssh_host_rsa_key
-rw-r--r-- 1 root root    382 Ноя 17 08:09 ssh_host_rsa_key.pub
ssh]#

файл  ssh_config:

#    $OpenBSD: ssh_config,v 1.21 2005/12/06 22:38:27 reyk Exp $

# This is the ssh client system-wide configuration file.  See
# ssh_config(5) for more information.  This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.

# Configuration data is parsed as follows:
#  1. command line options
#  2. user-specific file
#  3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.

# Site-wide defaults for some commonly used options.  For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.

# Host *
#   ForwardAgent no
#   ForwardX11 no
#   RhostsRSAAuthentication no
#   RSAAuthentication yes
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   BatchMode no
#   CheckHostIP yes
#   AddressFamily any
#   ConnectTimeout 0
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/identity
#   IdentityFile ~/.ssh/id_rsa
#   IdentityFile ~/.ssh/id_dsa
#   Port 22
#   Protocol 2,1
#   Cipher 3des
#   Ciphers aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
Host *
    GSSAPIAuthentication yes
# If this option is set to yes then remote X11 clients will have full access
# to the original X11 display. As virtually no X11 client supports the untrusted
# mode correctly we set this to yes.
    ForwardX11Trusted yes
# Send locale-related environment variables
    SendEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES 
    SendEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT 
    SendEnv LC_IDENTIFICATION LC_ALL

файл sshd_config:

#    $OpenBSD: sshd_config,v 1.73 2005/12/06 22:38:28 reyk Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options change a
# default value.

#Port 22
#Protocol 2,1
Protocol 2
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 768

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
SyslogFacility AUTHPRIV
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6

#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile    .ssh/authorized_keys

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no
PasswordAuthentication yes

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
GSSAPIAuthentication yes
#GSSAPICleanupCredentials yes
GSSAPICleanupCredentials yes

# Set this to 'yes' to enable PAM authentication, account processing, 
# and session processing. If this is enabled, PAM authentication will 
# be allowed through the ChallengeResponseAuthentication mechanism. 
# Depending on your PAM configuration, this may bypass the setting of 
# PasswordAuthentication, PermitEmptyPasswords, and 
# "PermitRootLogin without-password". If you just want the PAM account and 
# session checks to run without PAM authentication, then enable this but set 
# ChallengeResponseAuthentication=no
#UsePAM no
UsePAM yes

# Accept locale-related environment variables
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES 
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT 
AcceptEnv LC_IDENTIFICATION LC_ALL
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#ShowPatchLevel no
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
#PermitTunnel no
#ChrootDirectory none

# no default banner path
#Banner /some/path

# override default of no subsystems
Subsystem    sftp    /usr/libexec/openssh/sftp-server

17

привожу файлы xinitrc (в /etc/X11/xinit/...)

#!/bin/sh
# Copyright (C) 1999 - 2005 Red Hat, Inc. All rights reserved. This
# copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the
# GNU General Public License version 2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Authors:
#    Mike A. Harris <mharris@redhat.com>

# Mandatorily source xinitrc-common, which is common code shared between the
# Xsession and xinitrc scripts which has been factored out to avoid duplication
. /etc/X11/xinit/xinitrc-common

# The user may have their own clients they want to run.  If they don't,
# fall back to system defaults.
if [ -f $HOME/.Xclients ]; then
    exec $SSH_AGENT $DBUS_LAUNCH $HOME/.Xclients || \
    exec $SSH_AGENT $HOME/.Xclients
elif [ -f /etc/X11/xinit/Xclients ]; then
    exec $SSH_AGENT $DBUS_LAUNCH /etc/X11/xinit/Xclients || \
    exec $SSH_AGENT /etc/X11/xinit/Xclients
else
    # Failsafe settings.  Although we should never get here
    # (we provide fallbacks in Xclients as well) it can't hurt.
    [ -x /usr/bin/xsetroot ] && /usr/bin/xsetroot -solid '#222E45'
    [ -x /usr/bin/xclock ] && /usr/bin/xclock -geometry 100x100-5+5 &
    [ -x /usr/bin/xterm ] && xterm -geometry 80x50-50+150 &
    [ -x /usr/bin/twm ] && /usr/bin/twm
fi

а также файл xinitrc

#!/bin/bash
# Copyright (C) 1999 - 2004 Red Hat, Inc. All rights reserved. This
# copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the
# GNU General Public License version 2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

# redirect errors to a file in user's home directory if we can
if [ -z "$GDMSESSION" ]; then
    # GDM redirect output itself in a smarter fashion
    errfile="$HOME/.xsession-errors"
    if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null ); then
        chmod 600 "$errfile"
        exec > "$errfile" 2>&1
    else
        errfile=$(mktemp -q /tmp/xses-$USER.XXXXXX)
        if [ $? -eq 0 ]; then
            exec > "$errfile" 2>&1
        fi
    fi
fi

SWITCHDESKPATH=/usr/share/switchdesk

# Mandatorily source xinitrc-common, which is common code shared between the
# Xsession and xinitrc scripts which has been factored out to avoid duplication
. /etc/X11/xinit/xinitrc-common

# This Xsession.d implementation, is intended to obsolte and replace the
# various mechanisms present in the 'case' statement which follows, and to
# eventually be able to easily remove all hard coded window manager specific
# content from this script.  See bug #142260 for additional explanation and
# details.  All window manager rpm packages and desktop environment
# packages should be modified to provide the Xsession.d/Xsession.$wm scripts
# to start themselves up.  In the future, the legacy switchdesk mechanisms
# and hard coded window managers and desktop environments will be removed from
# this script. 
XCLIENTS_D=/etc/X11/xinit/Xclients.d
if [ -d "$XCLIENTS_D" -a "$#" -eq 1 -a -x "$XCLIENTS_D/Xclients.$1.sh" ]; then
    exec -l $SHELL -c "$SSH_AGENT $DBUS_LAUNCH $XCLIENTS_D/Xclients.$1.sh"
else
# now, we see if xdm/gdm/kdm has asked for a specific environment
case $# in
1)
    if [ -x "$SWITCHDESKPATH/Xclients.$1" ]; then
       exec -l $SHELL -c "$SWITCHDESKPATH/Xclients.$1";
    fi;

    case "$1" in
    failsafe)
        exec -l $SHELL -c "xterm -geometry 80x24-0-0"
        ;;
    gnome)
        exec $SSH_AGENT /bin/sh -c "exec -l $SHELL -c \"$DBUS_LAUNCH gnome-session\"" 
        ;;
    kde|kde1|kde2)
        exec $SSH_AGENT /bin/sh -c "exec -l $SHELL -c \"$DBUS_LAUNCH startkde\""
        ;;
    twm)
        # fall back to twm
        exec $SSH_AGENT /bin/sh -c "exec -l $SHELL -c \"DBUS_LAUNCH twm\""
        ;;
    *)
       # GDM provies either a command line as the first argument or
       # provides 'failsafe', 'default' or 'custom'.  KDM will do the
       # same at some point
        if [ "$1" != "default" -a "$1" != "custom" ]; then
        exec $SSH_AGENT /bin/sh -c "exec -l $SHELL -c \"$DBUS_LAUNCH $1\""
        fi
        ;;
    esac
esac
fi

# otherwise, take default action
if [ -x "$HOME/.xsession" ]; then
    exec $SSH_AGENT /bin/sh -c "exec -l $SHELL -c \"$DBUS_LAUNCH $HOME/.xsession\""
elif [ -x "$HOME/.Xclients" ]; then
    exec $SSH_AGENT /bin/sh -c "exec -l $SHELL -c \"$DBUS_LAUNCH $HOME/.Xclients\""
elif [ -x /etc/X11/xinit/Xclients ]; then
    exec $SSH_AGENT /bin/sh -c "exec -l $SHELL -c \"$DBUS_LAUNCH /etc/X11/xinit/Xclients\""
else
    # should never get here; failsafe fallback
    exec -l $SHELL -c "xsm"
fi

18 (12.05.2011 11:09:53 отредактировано i2ks)

katux пишет:

не работает! но при этом постоянно висит это:

так gdm или xdm?
ps -ef|grep gdm что скажет?

It is good day to die ...
MS Windows 10
Заметки о главном...

19 (12.05.2011 14:54:57 отредактировано katux)

СПАСИБО всем еще раз большое!!!
Заработало!!!!!!
Алгоритм моих действий:
1) на своей машинке переключаюсь (Ctrl+Alt+F1) на первый терминал tty1, логинюсь под собой и в консоли набираю:

 Консоль:
$ xinit  -- :1 &

обратите внимание, что после двух тире пробел есть!
2) переключаюсь на tty8 (м.б. tty9 в некот дистр хотя точно не знаю)
3) создаем на своей машине публичный ключ (согласно http://www.lintest.ru/wiki/%D0%A2%D0%B5 … 8Ubuntu%29)
   
 Консоль:
$ ssh-keygen -t rsa

Публикуем этот ключ на удаленную машину, к которой будем подключаться
   

 Консоль:
$ ssh-copy-id -i ~/.ssh/id_rsa.pub user@host
     
подставляя свои значения user и host
запускаю:
 Консоль:
$ ssh -X 192.168.0.24

тот самый удаленный сервер, к которому хочу приконнектиться! логинюсь (указывая ключевую фразу согласно пунктам 3)
4) и последний штрих, запускаю гном:
 Консоль:
$ gnome-session

И все работает... правда малость ругается на что-то еще.. надо подразобраться. а так работает!  ag

20

katux пишет:

И все работает... правда малость ругается на что-то еще.. надо подразобраться. а так работает!

Молодец. Хватило терпения разобраться. Но не кажется что это какой то гемор? Либо это должно как то проще работать, либо программа сырая совсем.

SimplyLinux 7

21

Спасибо! Да если будут у кого другие варианты - пишите! я тоже поразбираюсь еще. Это ведь очень актуальная тема для многих! :cool: