Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Running a command as another non-root user Post 303001930 by bakunin on Tuesday 15th of August 2017 04:16:43 AM
Old 08-15-2017
Quote:
Originally Posted by bakunin
This would only work if sudo would accept passwords from stdin, which is not the case (for security reasons).
Thanks to RudiC who told me i have to correct myself: sudo does indeed read from stdin when called with the -S option. My bad.

It doesn't make that a good idea, though, and what i said still holds, plus: reading passwords from stdin is in itself a bad idea, which is why it isn't done so normally - not by sudo (without the -S), not by passwd and similar tools.

bakunin
This User Gave Thanks to bakunin For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Running a command or script as root

I'm writing an application (Progress language) that needs to: 1) load the contents of a cron table into the Progress application; 2) display this information in a human manner and allow a select group of people to update it (these people are logged in as themselves, not as root); 3) save... (3 Replies)
Discussion started by: rm-r
3 Replies

2. Shell Programming and Scripting

As root , running script as different user with su - problem

Dear All I am running into a situation where I am running a script as another user lets say oracle using su command as below, and the script fails because the .profile of oracle is not executed so the environment variables are not set. cat /etc/passwd | grep oracle... (4 Replies)
Discussion started by: dbsupp
4 Replies

3. Shell Programming and Scripting

root user command in shell script execute as normal user

Hi All I have written one shell script for GPRS route add is given below named GPRSRouteSet.sh URL="www.google.com" VBURL="10.5.2.211" echo "Setting route for $URL for GPRS" URL_Address=`nslookup $URL|grep Address:|grep -v "#"|awk -F " " '{print $2}'|head -1` echo "Executing ... (3 Replies)
Discussion started by: mnmonu
3 Replies

4. UNIX for Dummies Questions & Answers

Allow a user use a specific root command!

Hi, I like to allow an user to permit an root command " /usr/ucb/ps -auxwww", do you know how? Kind regards Mehrdad (6 Replies)
Discussion started by: mehrdad68
6 Replies

5. Shell Programming and Scripting

How to restrict root user from running some commands

is it possible that we can restrict the root user if he runs some commands?? e.g i want if root runs command 'rm etc/passwd', he shoudn't be able to run command and throws error :confused: (3 Replies)
Discussion started by: sheelsadan
3 Replies

6. UNIX for Dummies Questions & Answers

Execute a command as root from normal user

Hi , I am trying to stop and start a process using the below code. I have sudo access on my machine ## PID = process id echo "$PASSWD" | sudo -S kill -9 <PID> echo "$PASSWD" | sudo -S /opt/abc/startserver /opt/abc/startserver: error while loading shared libraries: librts.so: cannot open... (6 Replies)
Discussion started by: rakeshkumar
6 Replies

7. Shell Programming and Scripting

Running commands in remote node as root user

Platform :Oracle Linux 6.4 We are trying to automate the SAN level cloning from production RAC DB cluster to test. From a shell script, I would like to run the below command Step1,2 and 3 from Node1 in a sequential order as root user . How can I do this ? passwordless for root user is not... (2 Replies)
Discussion started by: kraljic
2 Replies

8. Shell Programming and Scripting

Root running a script calling to scp using user "xyz" is not authenticating!

Close duplicate thread. (0 Replies)
Discussion started by: denissi
0 Replies

9. Shell Programming and Scripting

CRON JOB not running - for tape backup from root user

I am trying a cron on root user to backup to tape using TAR command here is the cron entry 11 08 * * 6 /erdhot1cron 2>&1 >> /test3/scripts/dba/erdhot1cron.log here is script inside - edhot1cron #!/bin/bash vsysdt=`date +%d%m%y` date tar -cvf /dev/st0... (4 Replies)
Discussion started by: vijaymec50
4 Replies

10. Shell Programming and Scripting

Execute a command with root user

i m logged in with user1 id. i wish to execute the below as root user for which i tried several commands but all of them fail. sudo 'cat /tmp/tmp.file >>/etc/logger' Password: sudo: cat /tmp/tmp.file >>/etc/logger: command not found sudo cat /tmp/tmp.file >>/etc/logger bash:... (5 Replies)
Discussion started by: mohtashims
5 Replies
FTPASSWD(8)							 Debian GNU/Linux						       FTPASSWD(8)

NAME
ftpasswd - manipulates ProFTPD authentication files SYNOPSIS
ftpasswd --help|-h|--version ftpasswd --hash [ --des|--md5 ] [ --stdin ] [ --use-cracklib[=path] ] ftpasswd --passwd [ -F|--force ] [ --file=filename ] [--gecos=string ] [ --gid=gid ] [ --des | --md5 ] [ --not-system-password ] [ --stdin ] [ --use-cracklib[=path] ] --home=path ftpasswd --group [ -F|--force ] [ --enable-group-passwd ] [ --file=filename ] [ -m|--member ] [ --des|--md5 ] [ --stdin ] [ --use-cracklib[=path] ] --gid=gid ftpasswd --passwd --change-password --name=username DESCRIPTION
ftpasswd is a Perl script which can be used to manipulate the password and group files suitable for use with ProFTPD AuthUserFile and Auth- GroupFile configuration directives. The idea is somewhat similar to Apache's htpasswd program. Required options are --passwd, --group, or --hash. These specify whether ftpasswd is to operate on a passwd(5) format file, on a group(5) format file, or simply to generate a password hash, respectively. If used with --passwd, ftpasswd creates a file in the passwd(5) format, suitable for use with proftpd's AuthUserFile configuration direc- tive. You will be prompted for the password to use of the user, which will be encrypted, and written out as the encrypted string. By default, using --passwd will write output to "./ftpd.passwd", If used with --hash, ftpasswd generates a hash of a password, as would appear in an AuthUserFile. The hash is written to standard out. This hash is suitable for use with proftpd's UserPassword directive. If used with --group, ftpasswd creates a file in the group(5) format, suitable for use with proftpd's AuthGroupFile configuration direc- tive. By default, using --group will write output to "./ftpd.group". OPTIONS
-F, --force If the password or group file be used already exists, delete it and write a new one. --file=filename Write output to specified file (password or group files), rather than default one. --gecos=string Descriptive string for the given user (usually the user's full name). --gid=gid Set primary group ID for this user (optional, will default to given --uid value if absent) when --passwd is specified. --uid=uid numerical group ID. -h, --help, --version Show usage and version of the program. --home=path Set the home directory for the user (required). --des, --md5 Use the DES or MD5 algorithm for encrypting passwords. The latter is the default. --name=username, --name=groupname Name of the user account or group (required). If the name does not exist in the specified output-file, an entry will be created for it. Otherwise, the given fields will be updated. --shell=path Shell for the user (required). Recommended: /bin/false --change-password Update only the password field for a user. This option requires that the --name option be used, but no others. This also double- checks the given password against the user's current password in the existing passwd file, and requests that a new password be given if the entered password is the same as the current password. --not-system-password Double-checks the given password against the system password for the user, and requests that a new password be given if the entered password is the same as the system password. This helps to enforce different passwords for different types of access. --stdin Read the password directly from standard in rather than prompting for it. This is useful for writing scripts that automate use of ftpasswd. --use-cracklib[=path] Causes ftpasswd to use Alec Muffet's cracklib routines in order to determine and prevent the use of bad or weak passwords. The optional path to this option specifies the path to the dictionary files to use -- default path is /usr/lib/cracklib_dict. This requires the Perl Crypt::Cracklib module to be installed on your system. --enable-group-passwd Prompt for a group password. This is disabled by default, as group passwords are not usually a good idea at all. -m username, --member=username user to be a member of the group. This argument may be used This argument may be used multiple times to specify the full list of users to be members of this group. BUGS
No known bugs at this time. If you discover any bugs, please contact the author. AUTHOR
This program has been written by TJ Saunders <tj@castaglia.org> as a contributed software for ProFTPD. SEE ALSO
proftpd(8), passwd(5), group(5), ftpusers(8), ftpstats(8), proftpd.conf(5) CREDITS
This manual page was written by Francesco Paolo Lovergine <frankie@debian.org>. Last update Thu Mar 10 16:45:27 UTC 2011 by Mahyuddin Susanto <udienz@ubuntu.com> for the Debian GNU/Linux system (but may be used by others). 1.1.2 October 19, 2002 FTPASSWD(8)
All times are GMT -4. The time now is 07:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy