test-01/linux.sh
2024-07-21 17:27:22 +02:00

40 lines
852 B
Bash

#!/bin/bash
# 1. Connect to the server
ssh user@192.168.1.10
# 2. Navigate to /var/log
cd /var/log
# 3. List files and directories and save to log_list.txt
ls > ~/log_list.txt
# or with details
ls -la > ~/log_list.txt
# 4. Create a new user named testuser without a home directory
sudo useradd -M testuser
# 5. Create a directory named testdir in your home directory
cd ~
mkdir testdir
# or
mkdir ~/testdir
# or if need create parent dir
mkdir -p ~/testdir
# 6. Change permissions of testdir
cd ~
chmod 700 testdir
# or if need recursive mode
chmod -R 700 ~/testdir
# or you can create folder with permissions
mkdir -r 700 -p ~/testdir
# 7. Display the current network configuration
ifconfig
# or
ip addr
# 8. Update the package list and install curl for debian and ubuntu and other debian based distro
sudo apt update
sudo apt install -y curl