Blog

How to change root password on Alpine Linux

I am a new user of Alpine Linux and running on LXD server. I need to change the password for root user account on Alpine Linux. How do I change the root password on Alpine Linux using command line options?

Introduction – You need to use the passwd command. It is used to update the user’s authentication token(s) i.e. password. Let us see how to change the root user password on Alpine Linux.

How to change change root password on Alpine Linux

The procedure for changing the password of root is as follows:

  1. First, log in to the Alpine Linux server using ssh or console or lxc command
  2. Open a shell prompt and type the passwd command to change root password in Alpine Linux
  3. The actual command to change the password for root on Alpine Linux is sudo passwd root

NOTE: Please note that vivek@utls-newsletter:~ $ is my shell prompt. You need to type commands after the $ prompt.

Alpine Linux change root password command

I am going to log in to my Alpine Linux 3.x server/VM/container using the ssh command:
vivek@macOS_nixcraft:~ $ ssh vivek@alpine-vm42
Once logged in enter the command passwd as follows:
vivek@utls-newsletter:~ $ sudo passwd root
First you need to type the password for vivek user. After that the passwd command asks for the new password, which you will have to enter two times:

Changing root account passwords on an Alpine Linux based server/vm/container

The next time you log in to a Alpine Linux server/workstation, use the new password.

Slightly different procedure for changing passwords in Alpine Linux

One can use the following procedure too:
vivek@utls-newsletter:~ $ ssh user@your-centos-server-name-ip
Become a root user via the su command or sudo command:
vivek@utls-newsletter:~ $ sudo -i
OR
vivek@utls-newsletter:~ $ su -
Finally change your root user password:
passwd

Conclusion

This page explained the process for changing the password of root user using the passwd command on a Alpine Linux. For more info type the following man command on Alpine:
man passwd
OR
passwd --help
Sample outputs:

BusyBox v1.28.4 (2018-12-06 15:13:21 UTC) multi-call binary.
 
Usage: passwd [OPTIONS] [USER]
 
Change USER's password (default: current user)
 
	-a ALG	des,md5,sha256/512 (default sha512)
	-d	Set password to ''
	-l	Lock (disable) account
	-u	Unlock (enable) account

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Related posts

University of Michigan Considers Further Investment in A16z’s Crypto Fund

Viking Coin

Bitcoin Prices Steady As Subsidy Halving Inches Closer

Viking Coin

Microsoft Adds 5 New Blockchain Partners to Azure

Viking Coin

Police Mandate Use of Blockchain Hotel Registry in Indian City

Viking Coin

Bitcoin Foundation Names South African Investor as New Director

Viking Coin

Howto get Red Hat Enterprise Linux Installation Number

Viking Coin

Veteran Observer Tech Reporter Joins CoinDesk Editorial Team

Viking Coin

US Judge Delays Crypto Fraud Ruling Pending CFTC Response

Viking Coin

Bitcoin Up $2k on Day as Market Nears $400 Billion

Viking Coin