Configure Network Using ip
Command in Ubuntu Server
Temporary Method -
$ ip a # to get the interface name after connecting LAN
$ sudo ip a add 192.168.1.8/24 dev <network-interface-name>
$ ip link set dev <network-interface-name> up
$ sudo ip route add default via 192.168.1.1
Permanent Solution - Ref: https://netplan.io/examples/
$ vim /etc/netplan/00-installer-config.yaml
network:
version: 2
ethernets:
enx1027f579a565:
dhcp4: false
addresses: [192.168.1.10/24]
nameservers:
addresses: [8.8.8.8,8.8.4.4,192.168.1.1]
routes:
- to: default
via: 192.168.1.1
$ sudo netplan apply # or sudo netplan --debug apply
Allow ssh
Connection After Lid Down
$ sudo vim /etc/systemd/logind.conf
# Make the necessary changes
...
[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#UserStopDelaySec=10
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
HandleLidSwitch=ignore
#HandleLidSwitchExternalPower=suspend
HandleLidSwitchDocked=ignore
#HandleRebootKey=reboot
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
LidSwitchIgnoreInhibited=no
#RebootKeyIgnoreInhibited=no
#HoldoffTimeoutSec=30s
#IdleAction=ignore
...
Show Battery State
alias battery="upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E 'state|time\ to\full|percentage'"
Connect to Wi-Fi
$ sudo vim /etc/netplan/00-installer-config.yaml
network:
version: 2
ethernets:
...
wifis:
wlo1:
dhcp4: false
addresses: [192.168.1.10/24]
nameservers:
addresses: [8.8.8.8,8.8.4.4,192.168.1.1]
access-points:
"Access Point Name":
password: "Password"
Then apply the configuration -
$ sudo netplan apply --debug
chmod 400 on Windows
My use case - Setting permissions on a SSH Key File
Use the following command in PowerShell -
$path = ".\key-file-path.pem"
# Reset to remove explicit permissions
icacls.exe $path /reset
# Give current user explicit read-permission
icacls.exe $path /GRANT:R "$($env:USERNAME):(R)"
# Disable inheritance and remove inherited permissions
icacls.exe $path /inheritance:r
Original Source - https://stackoverflow.com/questions/43312953/using-icacls-to-set-file-permission-to-read-only/43317244#43317244