02-16-2018
I would politely suggest that expect is not the solution to your problem. If you are trying to automate login or sudo use, you should use the correct tools. For login with ssh, use SSH-keys. For sudo use, write the appropriate sudo rules that do not require a password.
You are probably over-complicating things by assuming that tools must talk to a user and that expect is your way to pretend to be that user.
The ps command should not need super-user privilege to run. What are you actually trying to achieve?
Kind regards,
Robin
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi Guys,
I was just wondering if anybody can help me with this problem.
OK, how we can get a value back from PL/SQL Script (not stored procedure/function)
See the below example: (for example aaa.sh)
#!/bin/ksh
VALUE=`sqlplus -s user/password@test_id <<EOF
@xxx.sq
EOF`
echo $VALUE
... (7 Replies)
Discussion started by: Shaz
7 Replies
2. Shell Programming and Scripting
I have a unix AIX script that ftps some files (mput, mget). How can I check (in the script) to see if the ftp failed? After the ftp I move the files out of the directory but do not want to move files that have not been sent. The script will run as a cron job. (2 Replies)
Discussion started by: rayg50
2 Replies
3. Shell Programming and Scripting
hi all
my system is linux red hat
i have a script that runs some object .
the object return some code to the system
i see the code by writing echo $?
i want to ask in the script if $? equals 14
how shell is do that in the script
thanks (3 Replies)
Discussion started by: naamas03
3 Replies
4. UNIX for Dummies Questions & Answers
Hi All,
Can anyone please let me know the syntax / how to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 'system()' function and '${?}'.
I am in a process to send the mail automatically with an attachment to bulk users. I have used 'Mailx' and 'Unencode'... (0 Replies)
Discussion started by: manas6
0 Replies
5. Shell Programming and Scripting
Hi Guys,,
I am having a unix script which is running the DB2 Insert command.
For the insert command, there were no records to be updated.
SQL0100W No row was found for FETCH, UPDATE or DELETE; or the result of a
query is an empty table. SQLSTATE=02000
+ + echo 1
STAGE_RC=1
+ ]
... (6 Replies)
Discussion started by: mac4rfree
6 Replies
6. Shell Programming and Scripting
Hello folks,
I have a question that if i type ls command and type echo $? it always show "0", how i could do this change that when i type ls it will show me 1, actually i want to change the return code of commands from 0 to 1.
Thanks
Bash (5 Replies)
Discussion started by: learnbash
5 Replies
7. Shell Programming and Scripting
I need to try and get the error return code from the tar command when being used as follows:
tar tvf tarfile 2>logfile | tee -f outputfile
ErrorStat="$?"
I would like to save the error return code from the tar command in a variable,
howver, the example above it is saving the 'tee' error... (7 Replies)
Discussion started by: nck
7 Replies
8. Shell Programming and Scripting
Hello,
I am woring on a script where I am getting strange situation.This script actually fetch the source code and tar that code and send to NAS location.This code resides in MKS tool...and we are fetching the source code on checkpoint label basis and script is working fine.First it synch the... (0 Replies)
Discussion started by: anuragpgtgerman
0 Replies
9. Shell Programming and Scripting
Hi there.
There is a shell script:
#!/bin/bash
ARGS=`(grep -i $1 old.txt || grep -i $1 new.txt) |awk 'BEGIN {FS=","}{print "\x27" $5 "\x27"}' | tr "\n" " "`
/usr/bin/expect -- << EXPECTEND
spawn -noecho myssh myhost.localnet
log_user 0
expect root
log_user 1
send "/home/one.pl... (4 Replies)
Discussion started by: urello
4 Replies
10. Shell Programming and Scripting
cat test.sh
#!/bin/sh
expect <<- EOF
set timeout 5
spawn ssh -o StrictHostKeyChecking=no lyang0@128.224.178.245 -C mkdir -p /tmp
expect {
"Password:" {send "root\r"}
}
spawn scp -o StrictHostKeyChecking=no /tmp/1 lyang0@128.224.178.245:/tmp/
... (1 Reply)
Discussion started by: yanglei_fage
1 Replies
LEARN ABOUT CENTOS
nx_server_selinux
nx_server_selinux(8) nx_server SELinux Policy documentation nx_server_selinux(8)
NAME
nx_server_r - nx_server user role - Security Enhanced Linux Policy
DESCRIPTION
SELinux supports Roles Based Access Control (RBAC), some Linux roles are login roles, while other roles need to be transition into.
Note: Examples in this man page will use the staff_u SELinux user.
Non login roles are usually used for administrative tasks. For example, tasks that require root privileges. Roles control which types a
user can run processes with. Roles often have default types assigned to them.
The default type for the nx_server_r role is nx_server_t.
The newrole program to transition directly to this role.
newrole -r nx_server_r -t nx_server_t
sudo is the preferred method to do transition from one role to another. You setup sudo to transition to nx_server_r by adding a similar
line to the /etc/sudoers file.
USERNAME ALL=(ALL) ROLE=nx_server_r TYPE=nx_server_t COMMAND
sudo will run COMMAND as staff_u:nx_server_r:nx_server_t:LEVEL
When using a a non login role, you need to setup SELinux so that your SELinux user can reach nx_server_r role.
Execute the following to see all of the assigned SELinux roles:
semanage user -l
You need to add nx_server_r to the staff_u user. You could setup the staff_u user to be able to use the nx_server_r role with a command
like:
$ semanage user -m -R 'staff_r system_r nx_server_r' staff_u
BOOLEANS
SELinux policy is customizable based on least access required. nx_server policy is extremely flexible and has several booleans that allow
you to manipulate the policy and run nx_server with the tightest access possible.
If you want to deny any process from ptracing or debugging any other processes, you must turn on the deny_ptrace boolean. Enabled by
default.
setsebool -P deny_ptrace 1
If you want to allow all domains to use other domains file descriptors, you must turn on the domain_fd_use boolean. Enabled by default.
setsebool -P domain_fd_use 1
If you want to allow all domains to have the kernel load modules, you must turn on the domain_kernel_load_modules boolean. Disabled by
default.
setsebool -P domain_kernel_load_modules 1
If you want to allow all domains to execute in fips_mode, you must turn on the fips_mode boolean. Enabled by default.
setsebool -P fips_mode 1
If you want to enable reading of urandom for all domains, you must turn on the global_ssp boolean. Disabled by default.
setsebool -P global_ssp 1
MANAGED FILES
The SELinux process type nx_server_t can manage files labeled with the following file types. The paths listed are the default paths for
these file types. Note the processes UID still need to have DAC permissions.
nx_server_home_ssh_t
/opt/NX/home/nx/.ssh(/.*)?
/usr/NX/home/nx/.ssh(/.*)?
/var/lib/nxserver/home/.ssh(/.*)?
nx_server_tmp_t
nx_server_var_lib_t
/opt/NX/home(/.*)?
/usr/NX/home(/.*)?
/var/lib/nxserver(/.*)?
nx_server_var_run_t
/opt/NX/var(/.*)?
ssh_home_t
/var/lib/[^/]+/.ssh(/.*)?
/root/.ssh(/.*)?
/var/lib/one/.ssh(/.*)?
/var/lib/pgsql/.ssh(/.*)?
/var/lib/openshift/[^/]+/.ssh(/.*)?
/var/lib/amanda/.ssh(/.*)?
/var/lib/stickshift/[^/]+/.ssh(/.*)?
/var/lib/gitolite/.ssh(/.*)?
/var/lib/nocpulse/.ssh(/.*)?
/var/lib/gitolite3/.ssh(/.*)?
/var/lib/openshift/gear/[^/]+/.ssh(/.*)?
/root/.shosts
/home/[^/]*/.ssh(/.*)?
/home/[^/]*/.ansible/cp/.*
/home/[^/]*/.shosts
COMMANDS
semanage fcontext can also be used to manipulate default file context mappings.
semanage permissive can also be used to manipulate whether or not a process type is permissive.
semanage module can also be used to enable/disable/install/remove policy modules.
semanage boolean can also be used to manipulate the booleans
system-config-selinux is a GUI tool available to customize SELinux policy settings.
AUTHOR
This manual page was auto-generated using sepolicy manpage .
SEE ALSO
selinux(8), nx_server(8), semanage(8), restorecon(8), chcon(1), sepolicy(8) , setsebool(8), nx_server_ssh_selinux(8),
nx_server_ssh_selinux(8)
mgrepl@redhat.com nx_server nx_server_selinux(8)