- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Disable motd for "su" commands.
Operating System - HP-UX
1819998
Members
3966
Online
109608
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
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
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
тАО02-03-2009 09:52 AM
тАО02-03-2009 09:52 AM
Hi.
I have some scripts that do:
su - user -c "command"
The problem is that the above shows the motd of the server, exactly like you were login in as "user".
I cannot redirect stdout nor stderr to /dev/null because I need the output of command execution.
Is there any way to "hide" motd message in this case while keeping it for standard logins?
Thanks.
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-03-2009 09:59 AM
тАО02-03-2009 09:59 AM
Re: Disable motd for "su" commands.
http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1246203
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-03-2009 10:00 AM
тАО02-03-2009 10:00 AM
Re: Disable motd for "su" commands.
Only by removing that "-". You'll need to change your command to not depend on that user's .profile.
I'm not sure you want to fiddle with /etc/profile and use advanced AI technology to figure out whether su changed the name of users in your process tree.
I'm not sure you want to fiddle with /etc/profile and use advanced AI technology to figure out whether su changed the name of users in your process tree.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-03-2009 10:10 AM
тАО02-03-2009 10:10 AM
Solution
Hi:
Instead of doing 'su -' which causes the user's profile to be sourced (read), build a file of all the environmental variables you normally want when you login to that user. Then you can source that file as a part of the user's profile _AND_ when you perform a simple 'su'.
Thus:
# cat myvars
#!/usr/bin/sh
export MYID=me
...now source this in the user's '.profile':
. ${HOME}/myvars
...and when you need to 'su' (for example):
# su jrf -c ". myvars;env|grep me;date"
NOTE carefully that to source you type a dot followed by whitespace, followed by the file to be sourced.
Regards!
...JRF...
Instead of doing 'su -' which causes the user's profile to be sourced (read), build a file of all the environmental variables you normally want when you login to that user. Then you can source that file as a part of the user's profile _AND_ when you perform a simple 'su'.
Thus:
# cat myvars
#!/usr/bin/sh
export MYID=me
...now source this in the user's '.profile':
. ${HOME}/myvars
...and when you need to 'su' (for example):
# su jrf -c ". myvars;env|grep me;date"
NOTE carefully that to source you type a dot followed by whitespace, followed by the file to be sourced.
Regards!
...JRF...
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP