SG(1) User Commands SG(1)NAME
sg - execute command as different group ID
SYNOPSIS
sg [-] [group [-c ] command]
DESCRIPTION
The sg command works similar to newgrp but accepts a command. The command will be executed with the /bin/sh shell. With most shells you may
run sg from, you need to enclose multi-word commands in quotes. Another difference between newgrp and sg is that some shells treat newgrp
specially, replacing themselves with a new instance of a shell that newgrp creates. This doesn't happen with sg, so upon exit from a sg
command you are returned to your previous group ID.
CONFIGURATION
The following configuration variables in /etc/login.defs change the behavior of this tool:
SYSLOG_SG_ENAB (boolean)
Enable "syslog" logging of sg activity.
FILES
/etc/passwd
User account information.
/etc/shadow
Secure user account information.
/etc/group
Group account information.
/etc/gshadow
Secure group account information.
SEE ALSO id(1), login(1), newgrp(1), su(1), gpasswd(1), group(5), gshadow(5).
shadow-utils 4.5 01/25/2018 SG(1)
Check Out this Related Man Page
SG(1) User Commands SG(1)NAME
sg - execute command as different group ID
SYNOPSIS
sg [-] [group [-c ] command]
DESCRIPTION
The sg command works similar to newgrp but accepts a command. The command will be executed with the /bin/sh shell. With most shells you may
run sg from, you need to enclose multi-word commands in quotes. Another difference between newgrp and sg is that some shells treat newgrp
specially, replacing themselves with a new instance of a shell that newgrp creates. This doesn't happen with sg, so upon exit from a sg
command you are returned to your previous group ID.
CONFIGURATION
The following configuration variables in /etc/login.defs change the behavior of this tool:
SYSLOG_SG_ENAB (boolean)
Enable "syslog" logging of sg activity.
FILES
/etc/passwd
User account information.
/etc/shadow
Secure user account information.
/etc/group
Group account information.
/etc/gshadow
Secure group account information.
SEE ALSO id(1), login(1), newgrp(1), su(1), gpasswd(1), group(5), gshadow(5).
shadow-utils 4.5 01/25/2018 SG(1)
I'd like to make an alias of commands which contains the command newgrp.
exple:
alias my_cmde newgrp toto; my_pg &
this line doesn't work. why ?
Thanks for your help (2 Replies)
I want to do these commands in a script:
if the user name is 'toto' then the user switch to the group toto_group and then 2 others scripts are launched.
Unfortunately, after the command 'newgrp' the 2 scripts are not launched correctly.
But if I do the same, by hand, one line per one line, it... (11 Replies)
Hi,
The "more" command is currently being used to display reports to users. However, "more" allows the user to shell out to the command prompt if they happen to type in "!" and they can also start editing the file if they type in "v". Is it possible to restrict users access to these by... (4 Replies)
Hi,
I need to extract information from a 4 GB file based on the following conditions:
1) Check for the presence of a set of account numbers
Each account number is present along with other information within
a PAGESTART and PAGEEND.
The file looks like this:
PAGESTART
ACCOUNT NO 123... (6 Replies)
Hi,
I have to write a shell script to sudo other account. Foreg,
i am working in account ramdev1, i have a sudo access where through shell script i need to sudo another account
ramdev2 and read a file "ram.inc" get those data and save it in a .txt file and return it?
Since i am new to... (21 Replies)
Hi guys,
Been sifting through these forums for awhile, but never had an account or needed to post. Shoutouts to a great forum with heaps of useful info.
Now i consider myself a noob when it comes to linux and to bash scripting. I recently started to learn to use Vmware ESX server which uses... (4 Replies)
Hi,
i would like to retrieve (only retrieve, not execute) a previous command which i executed on the command prompt. I tried the 'up arrow' key, but its not working. Instead,it showed me some funny characters. I searched around and i found the way to do it was using the way below. Several... (5 Replies)
Wrote a script to create a hidden account in OS X. It works perfect but I need to check if the UID is already in use before I tried to create the account.
dscl . list /Users UniqueID | awk '{print $2}' | while read UIDS
do
if ; then
echo "UID Is Already in USE"
i=`expr "$2" - 1`
echo... (4 Replies)
We have a program that when a new account is created using the webpage it creates a new directory on the linux filesystem for the account. The problem is the process that creates the directory is as root user, as I want ftpuser to be able to login I have to manually login and chown -R the... (1 Reply)
hi,
i have records like this
supplier,product, persons involved
10,150,ravi@yahoo.com
30,200,ravi@yahoo.com
20,111,payal@gmail.com
40,211,ravi@yahoo.com
i want to write a command which displays values like this
10,30,40,ravi@yahoo.com
for ravi@yahoo.com if there are n number of... (7 Replies)
Hi All,
I want to create an user account which can only excute "df -kh" and "prstat -a" command. The user will not be able to perform "rm" and other critical commands.
Is there a way to do it?
rgds,
Ronny (2 Replies)
Hi,
I have to add the 'newgrp' command to my login (.cshrc) script.
The problem is that if I add it, it comes to infinite look, since newgrp opens new shell again and again.
How to automate the newgrp when I have to login, and avoid that loop?
Currently I'm thinking of a condition that... (2 Replies)
Hi,
I have several engineers logging into servers with the same system username and passwords eg root. I was thinking about adding a script to bashrc where a user is forced upon login to enter their name and once that has executed there history is logged/redirected to a log file somewhere. I... (10 Replies)
I have a handful of users who can't 'newgrp' to one specific group from Solaris 9 and 10 nodes and always get this prompt:
newgrp: Password:
We never get prompted by 20+ other groups and this group never prompts for a password from Red Hat Linux nodes. Authentication comes from AD and there's... (4 Replies)
hi
I like files
chage chsh mount pam_timestampcheck ping pt_chown su su_exec unix_chkpwd chfn gpasswd newgrp passwd ping6 sshkeysign sudo umount usernetctl
Instead, I wrong copy
I've cut
The system is rebooted
Rooh is read-only access
??????????????????????????!!!!!! (1 Reply)