Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have installed openssh-server from Synaptics, as usual, on a brand new Ubuntu Desktop computer, 10.10, with all updates and patches implemented.

If I have the local console logged in, I can SSH to the box, with no problem. If the local console is not logged in, I cannot SSH to the box. And If I have an SSH connection currently running, and log out of the local console, the SSH session will soon after be disconnected.

Looks to me like the network connection is only working when a user is actually logged in Ubuntu.

Is this normal behavior ? Is there a way to avoid this ?

Merci !

share|improve this question
    
What type of connection are you using ? If it's a wireless connection you must set it up to be "available for all users", otherwise it will depend on the user login. –  João Pinto Dec 20 '10 at 14:16
    
Actually, this is a <b>wired</b> connection. But I forgot to mention that this is a wired connection for a virtual machine. And I am trying to connect from another network segment to this virtual machine. –  jfmessier Dec 20 '10 at 17:11

1 Answer 1

Is this normal behavior ? Is there a way to avoid this ?

It is normal behaviour for non-wired connections. Network Manager handles the connection of wireless (and wired to some extent) connections and that won't jump into action until a privileged logs in.

You can circumvent it slightly by enabling auto-login (through System -> Administration -> Login Screen Settings) but this would reduce security. You could hop around that problem by having the desktop lock itself by adding xdg-screensaver lock as a start-up application (System -> Preferences -> Start up applications).

As João suggests, you'll probably need to make the connection "Available to all users" so that it doesn't ask for a keyring password (which obviously wouldn't get entered if nobody was there).

That's probably only practical if it's a single-user machine and it might not be as secure as not logging in at all.


Another method would be to take away the connection from Network Manager and have the underlying networking layer do the connection. You could try something like this in your /etc/network/interfaces file:

auto wifi0
iface wifi0 inet dhcp
    wireless-essid YOUR-AP-ESSID
    wireless-ap 00:11:22:33:44:55
    wireless-key YOUR-AP-KEY

Obviously replace wifi0 with the wireless interface, YOUR-AP-ESSID with the wireless access-point's ESSID, 00:11:22:33:44:55 with the MAC address of the AP and YOUR-AP-KEY with the proper key.

This has the side effect that anybody on the system can just cat /etc/network/interfaces and find your AP key. That might be bad... It depends on how secret it needs to remain. But only logged in people could see it.

This might not work and it might even make Network Manager explode. I can't say.


In the same vein as above, here is a blog post about using wpa_supplicant and /etc/network/interfaces: http://blog.nelhage.com/2008/08/using-wpa_supplicant-on-debianubuntu/

It's quite a old post but it might be slightly more secure than straight-up embedding your connection information into /etc/network/interfaces.


If we're just talking about a wired connection...

I notice that on newer installs of Ubuntu, the auto-connect state has been removed from /etc/network/interfaces for desktops. I guess Network Manager is doing that now. To add it back in, edit the interfaces file to add this:

auto eth0
iface eth0 inet dhcp

And for a static (non-DHCP) connection here's an example from one of my servers:

auto eth0
iface eth0 inet static
        address 95.172.14.178
        netmask 255.255.255.248
        network 95.172.14.176
        broadcast 95.172.14.183
        gateway 95.172.14.177
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 78.40.32.140
    post-up ethtool -K eth0 tx off

Some of those can be ignored or left to auto.

share|improve this answer
    
Sounds great to me. I indeed use a "wired" connection, as this is the ethernet card of my Virtual machine. It needs to be configured for static IP address, and other settings. How should I change the iface statement above to reflect the fact this is a static IP, if the IP is, say, 10.100.104.161 and the netmask is 255.255.254.0 ? –  jfmessier Dec 20 '10 at 17:17
    
@jfmessier edited! –  Oli Dec 21 '10 at 0:02
    
I actually made the changes to the config file, and I still have the issue. Whenever I logout of my console login,. I loose the SSH connection. –  jfmessier Dec 21 '10 at 12:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.