tty

sudoers NOPASSWD: sudo: no tty present and no askpass program specified

只谈情不闲聊 提交于 2019-12-03 20:49:19
问题 I have added a user like this: $ adduser --system --home /no/home --no-create-home --group --disabled-password --disabled-login testuser Added a user to a group: $ adduser testuser testgroup added lines to sudoers (visudo): testuser ALL=(ALL) NOPASSWD: ALL %testgroup ALL=(ALL:ALL) NOPASSWD: ALL When I try to run the bash script with the following content: #!/bin/sh sudo -u testuser /usr/bin/php /usr/local/bin/script.php But when I run this script, I get the error in the log: sudo: no tty

linux - write commands from one terminal to another

拥有回忆 提交于 2019-12-03 19:13:17
问题 I need to write commands from one terminal to another terminal. I tried these: echo -e "ls\n" > /proc/pid/fd/0 echo -e "ls\n" > /dev/pts/4 Which just prints the ls as output and doesn't execute. I tried these: chmod 777 /dev/tty4 ;echo "ls" > /dev/tty4 chmod 777 /dev/tty40 ;echo "ls" > /dev/tty40 Which don't seem to do anything Any ideas? [note that I don't want to touch the second terminal to accomplish this. only the first one] 回答1: Python code: #!/usr/bin/python import sys,os,fcntl,termios

What is the difference between writing to STDOUT and a filehandle opened to “/dev/tty”?

南笙酒味 提交于 2019-12-03 17:47:30
问题 What are the differences between this two examples? #!/usr/bin/perl use warnings; use 5.012; my $str = "\x{263a}"; open my $tty, '>:encoding(utf8)', '/dev/tty' or die $!; say $tty $str; close $tty; open $tty, '>:bytes', '/dev/tty' or die $!; say $tty $str; close $tty; # ------------------------------------------------------- binmode STDOUT, ':encoding(utf8)' or die $!; say $str; binmode STDOUT, ':bytes' or die $!; say $str; 回答1: The difference is that you are writing to two distinct and (from

ksh: how to probe stdin?

左心房为你撑大大i 提交于 2019-12-03 16:57:28
I want my ksh script to have different behaviors depending on whether there is something incoming through stdin or not: (1) cat file.txt | ./script.ksh (then do "cat <&0 >./tmp.dat" and process tmp.dat) vs. (2) ./script.ksh (then process $1 which must be a readable regular file) Checking for stdin to see if it is a terminal[ -t 0 ] is not helpful, because my script is called from an other script. Doing "cat <&0 >./tmp.dat" to check tmp.dat's size hangs up waiting for an EOF from stdin if stdin is "empty" (2nd case). How to just check if stdin is "empty" or not?! vladr EDIT: You are running on

Make R (statistics package) wait for keyboard prompt when run within a bash script

混江龙づ霸主 提交于 2019-12-03 12:47:13
I am using R to generate a series of plots within a loop, with the user hitting the enter key to indicate they have seen the plot and it is time to move on. These are interactive rotatable plots generated with the rgl package and therefore using something like Sys.sleep() is not good enough. Currently I can use readline() which works find when running R interactively. However, if I want to run my R script within a bash script all the plots appear flashing before the screen. This happens whether I call R using: R --no-save -f myfile.r R --no-save -e "source('myfile.r')" R --no-save << myfile.r

Why does ssh wait for my subshells without -t, and kill them with -t?

痞子三分冷 提交于 2019-12-03 12:29:58
问题 I have a bash script start.sh which looks like this: for thing in foo bar; do { background_processor $thing cleanup_on_exit $thing } & done This does what I want: I run start.sh, it exits with code 0, and the two subshells run in the background. Each subshell runs background_processor , and when that exits, it runs cleanup_on_exit . This works even if I exit the terminal from which I originally ran start.sh (even if that was an ssh connection). Then I tried this: ssh user@host "start.sh" This

Mac OS analog to /dev/ttyUSBxx

半世苍凉 提交于 2019-12-03 12:12:10
I used to linux USB port naming, aka /dev/ttyUSBxx and currently trying to write some test software to read/wrtie raw data to USB ports on iMac, but i find it hard to detect to which port my usb hardware is connected. I have tried up to a using /dev/ttys"x" but no luck. In the system information i see the hardware attached at Location ID: 0xfa120000 / 6 maybe this can help somehow? OS X doesn't create a /dev entry for raw access to USB devices, and there's no way to access them as TTY devices. Partly this is a different in philosophy between Linux and BSD, partly it's a difference in driver

How to switch linux kernel console after boot process?

夙愿已清 提交于 2019-12-03 11:47:08
问题 On my embedded system I usually use /dev/ttyS0 as a main console. This is achieved by passing kernel parameter console=/dev/ttyS0 and when init takes its part, getty is fired on the same device as specified in inittab by eg. ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100 . Is there any possibility to change these settings without restart and switch the console to another terminal like ttyS1 , ttyUSBx or even some pseudo tty? 回答1: It seems that perhaps you don't actually want the console log

What does TTY mean in the unix ps command?

坚强是说给别人听的谎言 提交于 2019-12-03 10:39:09
问题 When I run PS one of the columns output is TTY. What does this mean? In particular, how does as value of "??" compare with "ttys000"? I ask because I have a Java program execute sort via ProcessBuilder, and when this program is run via my IDE (IntelliJ) the process takes 5x less than when run as an executable jar outside the IDE. In each case I run ps when the sort is running and the only difference is the IDE creats a process with a TTY of ?? whereas the jar creates a process with TTY of

What is the difference between writing to STDOUT and a filehandle opened to “/dev/tty”?

喜欢而已 提交于 2019-12-03 06:33:44
What are the differences between this two examples? #!/usr/bin/perl use warnings; use 5.012; my $str = "\x{263a}"; open my $tty, '>:encoding(utf8)', '/dev/tty' or die $!; say $tty $str; close $tty; open $tty, '>:bytes', '/dev/tty' or die $!; say $tty $str; close $tty; # ------------------------------------------------------- binmode STDOUT, ':encoding(utf8)' or die $!; say $str; binmode STDOUT, ':bytes' or die $!; say $str; The difference is that you are writing to two distinct and (from Perl's and your program's point of view) independent file handles. The first one is a file handle opened to