diff --git a/.vitepress/config.mts b/.vitepress/config.mts index 1e8e1b5..4376b2b 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -117,6 +117,14 @@ export default defineConfig({ { text: 'Run EF Core Migrations', link: '/github-actions/run-ef-core-migrations' }, ] }, + { + text: 'Linux', + link: '/linux/', + collapsed: true, + items: [ + { text: 'Add User to Linux', link: '/linux/add-user' }, + ] + }, { text: 'Nginx', link: '/nginx/', diff --git a/docs/index.md b/docs/index.md index 3a0e5aa..fc82aff 100644 --- a/docs/index.md +++ b/docs/index.md @@ -46,6 +46,10 @@ hero: text: Github Actions link: /github-actions/ + - theme: alt + text: Linux + link: /linux/ + - theme: alt text: Nginx link: /nginx/ diff --git a/docs/linux/add-user.md b/docs/linux/add-user.md new file mode 100644 index 0000000..8df8f52 --- /dev/null +++ b/docs/linux/add-user.md @@ -0,0 +1,43 @@ +# Add User to Linux + +To add a user to a Linux system use the add user command: + +```bash +sudo adduser username +``` + +To enable sudo privileges for the user, add the user to the sudo group: + +```bash +sudo usermod -aG sudo username +``` + +To setup a ssh key for the user, switch to the user and create the .ssh directory: + +```bash +sudo su - username +mkdir ~/.ssh +chmod 700 ~/.ssh +``` + +Then create the authorized_keys file and add the public key: + +```bash +touch ~/.ssh/authorized_keys +chmod 600 ~/.ssh/authorized_keys +vim ~/.ssh/authorized_keys +``` + +Paste the public key into the file and save it. The user should now be able to log in using the ssh key. + +To enable sudo without a password, edit the sudoers file: + +```bash +sudo visudo +``` + +Add the following line to the end of the file: + +```bash +username ALL=(ALL) NOPASSWD:ALL +``` diff --git a/docs/linux/index.md b/docs/linux/index.md new file mode 100644 index 0000000..7e1fd46 --- /dev/null +++ b/docs/linux/index.md @@ -0,0 +1,3 @@ +# Linux Snippets and Musings + +#### [Add User to Linux](./add-user.md) \ No newline at end of file