Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian User (http://www.linux-archive.org/debian-user/)
-   -   Screen clear on terminal logout (was Orphaned User Accounts?) (http://www.linux-archive.org/debian-user/447623-screen-clear-terminal-logout-orphaned-user-accounts.html)

Morgan Gangwere 11-03-2010 03:42 PM

Screen clear on terminal logout (was Orphaned User Accounts?)
 
On 11/3/2010 9:30 AM, Carlos Mennens wrote:
> I always wanted to tell them I hate the fact that when 'root' logs
> out, the terminal / bash window doesn't clear like it does for normal
> users. I think this should be a Debian default behavior. I can't see a
> reason beyond over looking it as to why all my commands are still
> visible as root after I log out.

Even normal users have their last login shown. its not root-specific,
its a problem with the login getter.

--

Morgan Gangwere

PGP Key at http://indrora.homelinux.org/gpg_key.asc

>> Why?
> Because it breaks the logical flow of conversation, plus makes
messages unreadable.
>>> Top-Posting is evil.

James Zuelow 11-03-2010 04:00 PM

Screen clear on terminal logout (was Orphaned User Accounts?)
 
----Original Message----
From: Morgan Gangwere [mailto:0.fractalus@gmail.com]
Sent: Wednesday, November 03, 2010 8:42 AM
To: debian-user@lists.debian.org
Subject: Screen clear on terminal logout (was Re: Orphaned User
Accounts?)

> On 11/3/2010 9:30 AM, Carlos Mennens wrote:
>> I always wanted to tell them I hate the fact that when 'root' logs
>> out, the terminal / bash window doesn't clear like it does for normal
>> users. I think this should be a Debian default behavior. I can't see
>> a reason beyond over looking it as to why all my commands are still
>> visible as root after I log out.
>
> Even normal users have their last login shown. its not root-specific,
> its a problem with the login getter.
>
>

Here's a workaround. This will clear the screen for all users:

mv /etc/issue /etc/issue.original
clear > /etc/issue
cat /etc/issue.original >> /etc/issue

James Z

--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4A09477D575C2C4B86497161427DD94C15B0D1FA3B@city-exchange07">http://lists.debian.org/4A09477D575C2C4B86497161427DD94C15B0D1FA3B@city-exchange07

Bob Proulx 11-03-2010 06:34 PM

Screen clear on terminal logout (was Orphaned User Accounts?)
 
James Zuelow wrote:
> > Carlos Mennens wrote:
> >> I always wanted to tell them I hate the fact that when 'root' logs
> >> out, the terminal / bash window doesn't clear like it does for normal
>
> Here's a workaround. This will clear the screen for all users:
>
> mv /etc/issue /etc/issue.original
> clear > /etc/issue
> cat /etc/issue.original >> /etc/issue

Except that clears the screen on login, not logout. It would have
effect on a hardware terminal since a logout there is usually followed
by the login prompt. But it won't have effect for any network access.

Bob

James Zuelow 11-03-2010 07:15 PM

Screen clear on terminal logout (was Orphaned User Accounts?)
 
----Original Message----
From: Bob Proulx [mailto:bob@proulx.com]
Sent: Wednesday, November 03, 2010 11:35 AM
To: debian-user@lists.debian.org
Subject: Re: Screen clear on terminal logout (was Re: Orphaned User
Accounts?)

> James Zuelow wrote:
>>> Carlos Mennens wrote:
>>>> I always wanted to tell them I hate the fact that when 'root' logs
>>>> out, the terminal / bash window doesn't clear like it does for
>>>> normal
>>
>> Here's a workaround. This will clear the screen for all users:
>>
>> mv /etc/issue /etc/issue.original
>> clear > /etc/issue
>> cat /etc/issue.original >> /etc/issue
>
> Except that clears the screen on login, not logout. It would have
> effect on a hardware terminal since a logout there is usually followed
> by the login prompt.

Sorry, my bad. Since getty respawns as soon as you log out, it effectively clears the screen as soon as you type 'exit', so that is what I use it for.

But you're right, it only works for the local display.


>But it won't have effect for any network access.

The only network access I typically do is ssh, and when I'm done I just close the konsole window. If I am working from a console I could just type `clear` when I'm done if I want to clear the screen. (Or, I log out and let my /etc/issue trick clear it for me.) I don't see how the remote machine could clear my local display.

However there's always a way. You could use a .bash_logout on the remote machine to clear the screen:

1) .bash_logout has one line:

/usr/bin/clear

Or if for some reason you can't do that, you can do it locally with an alias in .bashrc:

1) make a small bash script, /usr/local/bin/autoclear_ssh.sh:
#!/bin/bash
ssh $@ && clear

2) make an alias in your .bashrc:
alias ssh='/usr/local/bin/autoclear_ssh.sh'

3) Profit!!!

Then when you ssh to a server, the display will clear when you're done.

It's not perfect though, because if you send ssh a command that terminates right away like `ssh 192.168.1.1 ls` the script will clear the screen before you see your ls output. The .bash_logout is probably better.

There's got to be a zillion ways to do it.

James Z

--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4A09477D575C2C4B86497161427DD94C15B0D1FA41@city-exchange07">http://lists.debian.org/4A09477D575C2C4B86497161427DD94C15B0D1FA41@city-exchange07

Bob Proulx 11-03-2010 07:42 PM

Screen clear on terminal logout (was Orphaned User Accounts?)
 
James Zuelow wrote:
> >But it won't have effect for any network access.
>
> The only network access I typically do is ssh, and when I'm done I
> just close the konsole window. If I am working from a console I
> could just type `clear` when I'm done if I want to clear the screen.

Exactly my point! The user can always clear the display as
appropriate to clear any sensitive data still shown there.

> However there's always a way. You could use a .bash_logout on the
> remote machine to clear the screen:
> ...

Ahem... The previous discussion was concerning Debian's default for
just such a /etc/skel/.bash_logout script. I personally don't like
that and so remove it. But the original poster *did* like it and was
asking for having it expanded to cover /root/.bash_logout too.
Currently the /root account is set up by the debian-installer and
doesn't install the /etc/skel/* files like adduser does when adding
additional users. As such the root account is special simply because
it is the very first account installed on the system and is set up by
the debian-installer before the rest of the system is available.

> 1) .bash_logout has one line:
> /usr/bin/clear

You have *almost* duplicated the default Debian .bash_logout except
that the Debian version handles different terminal types too.

> Or if for some reason you can't do that, you can do it locally with
> an alias in .bashrc:
>
> 1) make a small bash script, /usr/local/bin/autoclear_ssh.sh:
> #!/bin/bash
> ssh $@ && clear
> 2) make an alias in your .bashrc:
> alias ssh='/usr/local/bin/autoclear_ssh.sh'
> 3) Profit!!!
> Then when you ssh to a server, the display will clear when you're done.

Or you could use Control-L after logging out when you want to clear
the screen. A lot less work. :-)

> It's not perfect though, because if you send ssh a command that
> terminates right away like `ssh 192.168.1.1 ls` the script will
> clear the screen before you see your ls output. The .bash_logout is
> probably better.

Losing information that I need from the screen is the annoyance.

> There's got to be a zillion ways to do it.

Or not do it. :-)

Cheers,
Bob


All times are GMT. The time now is 01:02 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.