Say I have an /etc/profile
# good stuff here
# ...
/usr/local/bin/obnoxious_ascii_art
Is there anything I can do to prevent the execution of the last line when I log in? Assume I don't necessarily have root access.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communitySay I have an /etc/profile
# good stuff here
# ...
/usr/local/bin/obnoxious_ascii_art
Is there anything I can do to prevent the execution of the last line when I log in? Assume I don't necessarily have root access.
If I can't prevent it, I can at least hide the output after the fact with this in my .bash_profile
:
clear
Or, if I know how many lines it is:
for l in {1..26}; do
tput cuu1 # move up a line
done
tput ed # clear to end of screen
wc -l
You can copy profile to your home, edit it as needed
after that, this should work
ssh -t user@host '. ~/profile ; bash'
-t Force pseudo-tty allocation
It depends on what do you mean by "obnoxious_ascii_art".
If it's admin's practical joke, you should simply talk to the guy with root access about it. In this case it's a social problem and you should solve it by social means, not with technology.
If it's something that actually does something, but you don't like it, try to ask yourself why it's there in the first place. Maybe it's security related? In such case - I'm sorry to say that, but just let it run - when the machine goes belly up, nobody will blame you.
If it's something broken (but the admin refuses to fix it, for any reason), or you're just curious, then Mark Plotnick's comment is the best solution I can think of.
I know it's not the kind of answer you expected, but technical brute forcing through the problem is not always the best way.
[ -e ~/.ascii_art_is_stupid ]
check to his script. I was merely curious (from a purely technical standpoint) to see if there were some obscure or interesting workarounds.
May 28, 2014 at 22:10
/etc/profile
is executed before any of your personal files, thus you don't get a chance to do anything about it.csh
and then exec your regular shell in your~/.login