Using Wifi on Ubuntu Server with auto connect on boot

Hi all,

during the setup of my small server, I had the need to use only Wifi network connection instead of the „standard“ LAN connection.

Using Wifi was possible during installation, but after the first boot after the installation process I was not able to connect to the internet from the server or connect to the server from another workstation. In other words: network connection was not working.

After several tries with installation of GUI (apt-get install xubuntu-desktop) and several Network manager ( network-manager, wicd –> very good tool) I found the solution. It seems that network manager are only working for a user. That means the user has to login to use that tools. But a server should connect directly on boot / startup. To get rid of that problem, I used the /etc/network/interfaces config file. I set the wlan0 connection to type „auto“ and I set the parameters for the WIFI ssid and password:

/etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto wlan0
iface wlan0 inet dhcp
wpa-ssid <MyWifiName>
wpa-psk <MyWPA_Password>
# This is an autoconfigured IPv6 interface
iface eth0 inet6 auto

You can try your settings with the ifup wlan0 and ifdown wlan0 commands.
ifup starts the wlan0 interface, ifdown stops it. You need to be root for those commands.

After your settings are correct, you can restart your server. The server should now automatically connect to your Wifi network on startup. You can also check the logs in:

/var/log/upstart

See also: http://askubuntu.com/questions/143988/how-do-i-bring-up-my-wireless-network-at-boot/144043#144043

 

Reset forgotten Linux passwords

If you forgot your Linux password, you can change it – without any rights. This article shows how:

Therefore boot in the single-user-mode. To do so, just choose the „recovery boot“ kernel while booting.

There, you can choose to drop to a root prompt.

In this terminal, just type:

passwd <username>

or, to set the root password:

passwd

After changing the password, just type reboot, to start the reboot of the system.

You now can login with your new given password.

However, not all Linux distributions allow to modify your password that way.

Change password – expiration in linux

If you just want to change a password you can use the passwd command.

If you want to set a time-limit after which the user has to change his passwort you can do that with this command:

sudo chage <username>

or:

sudo passwd -x 90 <username> ( 90 stands for 90 days )

If you want to see the password-settings for a user you can use this command:

sudo chage -l <username>

Example of the /etc/shadow file:

bc:$6$vvBxq0rK$nFUZQ3p0efbpwWUB2cZ3sk/4DX.:14673:0:99999:7:::

There are several values, which are seperated by a „:“. The first value, „bc“, is the username. The second is a hash value of the password and some other userdata.(Note: If two users have the same password, the hashes aren’t equal!

The third is the expiration date of the passwort. It gets computed by:

January 1st, 1970 + this value in days = expiration day

The fourth value is the number of days between two password changes. „0“ stands for:“not specified“

The fifth value is the number of days, the password is valid.

The sixt value is the number of days, the user should be warned before the password expires.

The seventh value is the number of days between the expiration of the password and the lock of the user account.

The last value is the expiration of the user account in days since the 1st of January in 1970.

You can edit the information as root, the tools mentioned above are only a frontend.

More information is available at: https://help.ubuntu.com/8.04/serverguide/C/user-management.html