forcing su on a user


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users forcing su on a user
# 1  
Old 01-13-2004
forcing su on a user

This is for 3 os's, AIX, Solaris, and AIX, didnt want to post three seperate times on the same subject, anyways, I want to force the user MQM to su, i.e. not be able to rlogin/telnet to the box as user MQM, only login as there ID(chris for example) and su to MQM, does anyone know how to do this, for the mentionend OS's, I believe you can only force root to su
# 2  
Old 01-13-2004
forget AIX, its possibel, i just need to know how it can be done in Solaris 8 and HP-UX 11
# 3  
Old 01-13-2004
Just an idea...

In the user's .profile, add the following at the top:

trap "" 1 2 3

REALUSER=`/usr/bin/who am i | /usr/bin/cut -f1 -d" "`
SUUSER=`/usr/xpg4/bin/id -un`

if [ "$REALUSER" = "$SUUSER" ]
then
stty 0
fi

Don't let the user own his/her own .profile. Owned by root, but readable by the user's group. Solaris supports RBAC (Role Based Access Control). Under Solaris you could actually have the user be a role, rather than a new user.

I'm sure there are other ways.

Cheers,

Keith
# 4  
Old 01-22-2004
On HP you can put this scripting in the /etc/profile. That is called everytime a user logs in... and is not writable by normal users other than root.


In addition you can make it an entry in /etc/hosts.allow and /etc/hosts.deny to restrict telnet and rlogin...
Just put this in these files... You may need to create them if they dont exist....

Here is a great link to a config of these files...http://ezine.daemonnews.org/200206/hosts_allow.html

I also put these others in to allow only these methods of accessing my boxes....

# cat /etc/hosts.allow
#all : all : banners=/usr/localcw/opt/sysguard/banners : allow
ftpd : all : banners=/usr/localcw/opt/sysguard/banners : allow
telnetd : <myuser> : banners=/usr/localcw/opt/sysguard/banners : allow
telnetd : all : banners=/usr/localcw/opt/sysguard/banners : deny
tftpd : all : banners=/usr/localcw/opt/sysguard/banners : allow
logind : all : banners=/usr/localcw/opt/sysguard/banners : allow
rlogind : all : banners=/usr/localcw/opt/sysguard/banners : deny
remshd: all : banners=/usr/localcw/opt/sysguard/banners : allow
sidftpd : all : banners=/usr/localcw/opt/sysguard/banners : allow
rexecd : all : banners=/usr/localcw/opt/sysguard/banners : allow
sshd : all : banners=/usr/localcw/opt/sysguard/banners : allow

root:/usr/local/bin
# cat /etc/hosts.deny
# Deny all hosts
ALL : ALL






Also, on HPUX there is a security file... do a man security to read about creating it... This file you will need to create in /etc/default/security



You can also restrict who can even attempt to su to root as well... see this part of the man security...

SU_ROOT_GROUP
This parameter defines the root group name for the su
command. Refer to su(1).

SU_ROOT_GROUP=group_name The root group name is set to
the specified symbolic group name. The su command
enforces the restriction that a non-superuser must be a
member of the specified root group in order to be
allowed to su to root. This does not alter password
checking.

Default value: If this parameter is not defined or if
it is commented out, there is no default value. In
this case, a non superuser is allowed to su to root
without being bound by root group restrictions.


Last edited by Kelam_Magnus; 01-22-2004 at 05:25 PM..
# 5  
Old 02-04-2004
Why not use sudo, this works on most *NIX systems.
Sudo has a neat interface for setting up "allowed" commands for *NIX users.

e.g put in /etc/sudoers the line
chris ALL=/bin/su - MQM


The next time chirs logs in to the *NIX system he/she is allowed to enter:

sudo su - MQM

Which requires his/her own password.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Forcing a write to a file without newline?

Hello, I am writing a program which runs with root privileges, and it creates a child with lowered privileges and has to redirect it's stdout and stderr to a file and then run bash. The problem is, whenever I read this file, I want to see all of the current output, even when the program is still... (10 Replies)
Discussion started by: madd-games
10 Replies

2. Shell Programming and Scripting

Forcing another user to run a shell script (su)

I'm trying to use su (as myuser) to force another user (theuser) to run a shell script (thescript.sh): su theuser -c /home/theuser/thescript.sh However I'm running this from another script, and it is asking for theuser's password. I would rather avoid displaying it in the file (using echo... (2 Replies)
Discussion started by: asdfgg
2 Replies

3. Hardware

Forcing Linux to keep charging my Kindle

Linux seems to have weird USB power saving features, my Kindle 3 only gets some charge before Linux powers down the USB port. When the device is mounted, it doesn't get enough power, with this same hardware under Windows I don't get the message on the Kindle "currently your kindle is not... (2 Replies)
Discussion started by: John Tate
2 Replies

4. Shell Programming and Scripting

Forcing a tty session but getting a password prompt?

I have a master host I want to use to issue some start/stop of LDAP services. I changed the client hosts /etc/sudoers to have Defaults:infra !requiretty The master host kicks off the jobs using the infra account doing a ssh session to the infra account on the clients. #!/bin/ksh ps -fu... (5 Replies)
Discussion started by: J-Man
5 Replies

5. UNIX for Dummies Questions & Answers

AWK: Backslash \ and forcing output not to go onto new lines

Dear all, I am using Mac OSX, have been successfully written an awk script during the last days. I use the script to convert parts of a .dot-file into graphml code. First question: Backslash My .dot-code includes repeatedly the sign "\n". I would like to search for this sign and substitute... (4 Replies)
Discussion started by: ingli
4 Replies

6. Red Hat

Forcing a kernel panic in RHEL 5.4

Hello, Is there a way to force a kernel panic in RHEL 5.4 in such a way that the machine reboots after the panic. Thanks, Kanna (1 Reply)
Discussion started by: kanna_geekworkz
1 Replies

7. UNIX for Dummies Questions & Answers

Forcing Makefile to Ignore Errors

Is there A way I can Force a makefile to ignore errors? i believe it is using gcc. i have a set of commands in the makefile that i want to run and each time the makefile gets to the point of this commands, it aborts because of the commands. how can i get the makefile to keep running... (3 Replies)
Discussion started by: SkySmart
3 Replies

8. Solaris

forcing password change every X days?

Hi, how do I go about forcing users to change their password every, say, 30 days? Aaron (1 Reply)
Discussion started by: amheck
1 Replies

9. Solaris

forcing users to su

Is there a way in solaris 9 to prevent a user to login via ssh, telnet, rlogin, and only be able to su as that user, for example have DBA joe blow login as jblow, and then su to oracle BUT not vice versa have DBA joe blow login as oralce (6 Replies)
Discussion started by: csaunders
6 Replies

10. UNIX for Dummies Questions & Answers

forcing irq on PCMCIA card

ENV: linux Version: Mandrake 8.1, PCMCIA card: longshine lcs-8534TB. (supported according the PCMCIA docs) laptop is P-II lifetec /etc/sysconfig/pcmcia: PCMCIA=yes PCIC=i82365 ( found via probe -m ) PCIC_OPTS="cs_irq=11 pci_irq_list=11,11 do_scan=0" ( you see i want to force irq 11 )... (3 Replies)
Discussion started by: progressdll
3 Replies
Login or Register to Ask a Question