简体   繁体   中英

How to display the execution result in remote linux screen(command input via ssh)?

everyone :

I need ssh to connect remote linux ,I already know how to run and display a GUI program in remote linux .It can be done by :

ssh username@ip
export DISPLAY=:0.0
firefox &

however ,my target linux hasn't X Window System , I need display the execution result in remote linux's screen ,for example :

my pc is A , remote pc is B

A use ssh access B , after connected to B ,I type ls in A then press enter

the execution result should display in B's screen (tty or whatever , I don't know what it should be called)

any idea? thanks for your help.

Basic idea:

a$ ssh user@b
b$ run-program >/dev/console

(I use a$ and b$ to indicate the shell prompts on A and B respectively.)

Problem with this:

b$ ls -l /dev/console
crw------- 1 root root 5, 1 Mar 19 09:10 /dev/console

Only root can write to /dev/console .

Possible workaround:

$b run-program | sudo tee /dev/console >/dev/null

(Redirecting to /dev/null here prevents the output from showing up on your screen as well.)

This does depend on user@b being allowed to run sudo tee /dev/console .

If you are sysadmin for B and user@b is not allowed to run sudo tee /dev/console , read man 5 sudoers and man 8 visudo to find out how to give user@b this permission.

If you are not sysadmin for B and user@b is not allowed to run sudo tee /dev/console , you will have to ask B's sysadmin to set this up for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM