- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- "mesg n" and /etc/profile
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2006 09:32 AM
08-16-2006 09:32 AM
"mesg n" and /etc/profile
I set "mesg n" in my /etc/profile, and I want to get rid of the "mesg: cannot change mode" message I get every time I use "su - username" when switching.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2006 09:41 AM
08-16-2006 09:41 AM
Re: "mesg n" and /etc/profile
I would think some variation of the who command will do it.
Also, there is an sulog that can be used to match against current sessions plus some evidence in the syslog itself.
This message is a good thing btw, not a bad. It shows that you don't permit terminal sessions to change settings on the fly. It prevents hacks.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2006 09:46 AM
08-16-2006 09:46 AM
Re: "mesg n" and /etc/profile
[ `echo ${0}` != "-su" ] && mesg n
this works for me, as all the users on my systems are only allowed to use /usr/bin/sh as their default shell.....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2006 09:46 AM
08-16-2006 09:46 AM
Re: "mesg n" and /etc/profile
[ `echo ${0}` != "-su" ] && mesg n
this works for me, as all the users on my systems are only allowed to use /usr/bin/sh as their default shell.....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2006 02:30 PM
08-16-2006 02:30 PM
Re: "mesg n" and /etc/profile
'who am i' returns real uid, while 'whoami' returns effective uid, so:
if [ "$(who am i)x" == "$(whoami)x" ];
then
# no su
else
# su
fi
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2006 03:17 AM
08-17-2006 03:17 AM
Re: "mesg n" and /etc/profile
if [ "$(who am i | awk '{print $1}')x" = "$(whoami)x" ];
then
# no su
else
# su
fi
PCS