From charlesreid1

Line 80: Line 80:
usermod -s /bin/bash ${USERNAME}
usermod -s /bin/bash ${USERNAME}


echo "If you want to add ${USERNAME} to sudo, do it yourelf."
echo "If you want to add ${USERNAME} to sudo group, run the command yourself:"
echo ""
echo "    usermod -G sudo ${USERNAME}"
echo ""


echo "Set password for ${USERNAME}:"
echo "Set password for ${USERNAME}:"
passwd ${USERNAME}
passwd ${USERNAME}
# Note: doing this in a script is a bad idea.
# usermod -G root ${USERNAME}
# You'll need to add them to sudoers anyway.
</pre>
</pre>


Add user to sudoers:
Once user is in sudo group, no need to add them to sudoers file.

Revision as of 11:42, 25 March 2017

  • Aptitude
    • apt get update
    • aptitude build scripts
  • Sysadmin stuff
    • Make non-root default user
  • SSH
    • No root login


Aptitude

Ubuntu 16.04 LTS

Fresh dev machine apt script

Runs apt-get for all the dev things you need. Ubuntu 16.04 LTS.

#!/bin/sh
#
# Run as root
# 
# Use the -s flag to simulate this command before actually running it,
# as libraries tend to shift around a lot between Ubuntu versions.

echo "export EDITOR=\"vim\"" >> ~/.bash_profile

apt-get install -y \
	aptitude \
	build-essential \
	checkinstall \
	make \
	m4 \
	bison \
	flex \
	tar \
	perl \
	binutils \
	sed \
	gawk \
	python2.7 \
	python3 python3-pip \
	\
	libreadline-gplv2-dev  \
	libncursesw5-dev \
	libssl-dev

Dotfiles

Wait until you create a user to install any dotfiles, of course. Root remains plain and uncontaminated.

Unix dotfiles - yargwid repo https://github.com/charlesreid1/yargwid

Mirror: http://git.charlesreid1.com/charlesreid1/yargwid

Users

See Unix/Sysadmin

Add a non-root user

#!/bin/sh

export USERNAME="zappa"

echo "Making user ${USERNAME}"
useradd ${USERNAME}

echo "Setting home directory /home/${USERNAME}"
mkdir -p /home/${HOME}
chown ${USERNAME} /home/${HOME}
usermod -d /home/${HOME} ${USERNAME}

echo "Setting ${USERNAME} shell to bash"
usermod -s /bin/bash ${USERNAME}

echo "If you want to add ${USERNAME} to sudo group, run the command yourself:"
echo ""
echo "    usermod -G sudo ${USERNAME}"
echo ""

echo "Set password for ${USERNAME}:"
passwd ${USERNAME}

Once user is in sudo group, no need to add them to sudoers file.