Linux / UNIX Tech Support Forum
This is a discussion on restrict a user to certain command within the Solaris/OpenSolaris forums, part of the UNIX operating systems category; Hi all, I am using Sun OS 5.10. I am new to Unix. Is there some way to restrict a ...
|
|||||||
| Solaris/OpenSolaris Discuss all about the SUN Solairs/OpenSolaris. You are free to talk about any issues related to Solaris administration, networking, services and other stuff, share information or ask doubts. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi all,
I am using Sun OS 5.10. I am new to Unix. Is there some way to restrict a specific user to certain command say "/usr/bin/more" ?? for example: I want that user1 can execute more command & user2 can't. Can we somehow edit .profile file in the home directory of user to achieve this ?? OR is there some other way ?? Pls help. Thanks N Regards, VIKAS |
| Sponsored Links | ||
|
|
|
|||
|
This code code has been coded by me to allow users only through a specific ip (ip is configurable as an entry need to be made in a file). This code is for 'vi' ing a file .. This will vi the file if nobody else is 'vi' ing it .. we can do the same for 'more' ing a file :
STEP I : ps -eaf | grep -w $USER | grep -v grep | grep -w vi | grep -w $1 >> /dev/null; #Just to check if someone is editing if [ $? != 0 ]; then echo "opening $1" cp -p $1 $HOME/TEMP_BKP/$1; vi $1; else echo "Please wait. following person is using this file : " ps -eaf | grep -w $USER | grep -v grep | grep -w vi | grep -w $1 | awk '{ print $6 }' | while read line do who | grep -w $line | awk '{print $6}' | while read ipaddr do grep -w $ipaddr $HOME/Application/Exec/ShellScripts/ip_name_link.txt #add the ip address of all users in this txt file if test $? -ne 0; then echo "Unknown $ipaddr" fi; done; done; fi; STEP II : Now add an alias in the .profile for more. example : assume, the above code is saved in a file open_file.sh. then in .profile we can have : alias vi="open_file.sh" # m assuming that the location of open_file.sh is set in the PATH variable. __________________________________________________ ______ HOPE MY INPUT IS OF SOME HELP .. FEEL FREE TO COMMENT ...!! __________________________________________________ ______ Regards Prasanna Pradip Kulkarni. |
|
||||
|
__________________
Vivek Gite Linux Evangelist |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Create new user account in Ubuntu Linux from command line | sweta | Getting started tutorials | 3 | 07-02-2010 12:15 PM |
| restrict access of a user to two directories only | vikas027 | CentOS / RHEL / Fedora | 0 | 15-04-2008 05:35 PM |
| UNIX command to find out whether particular process of a particular user is running | Santosh Sharma | Shell scripting | 1 | 17-01-2008 03:26 PM |
| How to restrict devices usage for users in Solaris? | kitty@sad | Solaris/OpenSolaris | 3 | 21-05-2007 02:05 PM |
| how to restrict lan users so that they cannot send | bhagi123 | Linux software | 2 | 21-11-2006 11:38 AM |