# Doing an "emerge" over ssh?

## MudPutty

If I do an "emerge" to install something over ssh, and then dissconect my ssh session, can I reconnect using ssh and be able to see the progress of the emerge install?

Or is there a better way of remotely installing using emerge?

----------

## compu-tom

No.

You can use

```
screen
```

 or 

```
nohup
```

.

Screen gives you an interactive screen session which can be detached from the terminal and later on be re-attached.

Nohup sends the output of a command to a log file and ignores SIGHUP. Therefore it will survive a ssh logout and keep on running...

Personally I prefer screen.

----------

## MudPutty

At the end of the emerge of "Screen" I recieved this msg: *Quote:*   

>  * screen is not installed as setuid root, which effectively disables multi-user
> 
>  * mode. To enable it, run:
> 
>  *
> ...

 

Does this mean that if I want "root" access to the screen command I need to follow their directions of "chmod..."?

----------

## compu-tom

No.

It means that you (if root or not) cannot simultanously hack into another user's screen session (and see and type what he/she sees or types).

+s permissions are not necessary to run screen as root.

BTW, I have the following ~/.screenrc

```
caption always

defscrollback 10000

startup_message off

#caption string "%Y-%m-%d %0c %3n %t (%W)"

caption string "%3n %t (%W)"
```

 which makes screen even more usable  :Smile: 

----------

## MudPutty

AHHHH, "the light goes on  :Idea:  " Great...Thanks! I will play around with "Screen" and see what I can break   :Laughing:  hehe.

----------

## MudPutty

MY HECK!!! There is a "TON" of information to read through for "Screen". Can you give me a few pointers/command examples to get started?

----------

## MudPutty

I found something to get me going...thanks again:

 *Quote:*   

> SCREEN Command Quick Reference
> 
> Screen creates a virtual terminal in which you can perform actions. The unique thing about this virtual terminal is that
> 
> you can disconnect from it and then reconnect to it without disturbing what is happening within it. The cool thing
> ...

 

----------

## compu-tom

All screen commands start with Ctrl-a (press the Ctrl-key and a lowercase a).

Here are some important commands (case-sensitive):

"Ctrl-a h" gives you a help screen.

"Ctrl-a c" creates a new screen window (it shows up in the bottom bar if you use my .screenrc). A fresh shell gets started in this window.

"Ctrl-a <SPACE>" cycles through the screen windows.

"Ctrl-a <NUMBER>" goes directly to the screen window with this number.

"Ctrl-a A" sets the shown title of the current screen window.

If you leave a shell the corresponding screen window goes away.

With the last screen window goes the screen itself.

To detach the screen (but keep the shells inside running), type "Ctrl-a d".

To re-attach screen, type

```
screen -r
```

.

For further information see the man page.

Good luck  :Smile: 

----------

## MudPutty

huh, some of the commands are not working. like "Ctrl-a h" I can't kill any of the windows either (instructions per the man file)...any ideas?

----------

## compu-tom

Ooops: It's "Ctrl-a ?"   :Embarassed: 

----------

## MudPutty

OK, i'm starting to get the hang of things now  :Smile:  thanks again!!!

----------

## pjp

Moved from Installing Gentoo.

----------

## dma

 *MudPutty wrote:*   

> At the end of the emerge of "Screen" I recieved this msg: *Quote:*    * screen is not installed as setuid root, which effectively disables multi-user
> 
>  * mode. To enable it, run:
> 
>  *
> ...

 

If you make it setuid root, you can do all sorts of wacky ACL stuff.

I once used it so a friend could watch me emerge stuff (I was demonstrating gentoo) in my root shell without being able to type anything.  It was pretty cool.

----------

## MudPutty

Now that I have been using Screen for a little bit i'm hooked! I have been showing it off to everyone that isn't familure with it...Screen is a great tool to have!

----------

## magic

Thanks ... I've been looking for this for a long time!!

----------

## triad

Never new this program existed.  Thanks all for the info.  Screen Rocks  :Smile: 

----------

## chrisis

can screen be used as default shell?  In otherwords can I create a user that when logged in /usr/bin/screen is the shell instead of /bin/bash?

I'm just a little unclear how to best use this. Do I, for eg:

1. ssh into my server, then start screen

2.  Do stuff, then detach, then exit my ssh

3.  Go somewhere else, ssh again, screen -r to get my screen session back?

Or does my /etc/password have to have shell set to screen instead of bash?

----------

## OdinsDream

You could put screen into your .bashrc file, or whatever file gets automatically read when you log in.

----------

## creche

 *MudPutty wrote:*   

> If I do an "emerge" to install something over ssh, and then dissconect my ssh session, can I reconnect using ssh and be able to see the progress of the emerge install?
> 
> Or is there a better way of remotely installing using emerge?

 

--nospinner

anyway use screen if u are making critical jobs.

Greets

----------

