screen -S SESSIONNAME. When creating a new session, this option can be used to specify a meaningful name for the session. This name identifies the session for “screen -list” and “screen -r” actions.
If you already started a session and later decide to name it.
Enter to a command mode (
Ctrl+a, :) and then type
To allow user01 to copy any files as root from /from/directory/ to /to/directory/ add the following to /etc/sudors file:
user01 ALL = NOPASSWD: /bin/cp /from/directory/* /to/directory/
And this one is for the multi commands:
user01 ALL = NOPASSWD: /bin/cp /from/directory/* /to/directory/, /bin/rm -rv /to/directory/*, /bin/ls -la /to/direcotry/*
As soon as the boot process starts, press ESC to bring up the GRUB boot prompt. You may need to turn the system off from the control panel and then back on to reach the GRUB boot prompt. You will see a GRUB boot prompt – press “e” to edit the first boot option. Find the kernel line
linux (Each menuentry block that represents an installed Linux kernel contains linux on 64-bit IBM POWER Series, linux16 on x86_64 BIOS-based systems, and linuxefi on UEFI-based systems. Then the initrd directives followed by the path to the kernel and the initramfs image respectively) and add
init=/bin/sh at the end of the line and then press CTRL-X to boot.
System will boot and you will see the root prompt. Type
mount -rw -o remount / and then
passwd to change the root password and then
touch /.autorelabel and then
init=/bin/sh – In case of VMWare like KVM or VirtualBox use rb.break instead of inti=/bin/sh
# mount -o remount,rw /
# passwd root
[Enter New Password]
[Re-enter New Password]
# touch /.autorelabel
# exec /sbin/init
It should look like this one:
2: linux16 /vmlinuz-3.10.0-229.7.2.e17.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet LANG=en_IE.UTF-8 systemd.debug
3: initrd16 /initramfs-3.10-0-229.7.2.el7.x86_64.img
# Allow OpenVPN
iptables -A INPUT -p udp -m state --state NEW -m udp --dport 1194 -j ACCEPT
iptables -A FORWARD -s 192.168.88.0/24 -j ACCEPT
iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
# iptables -t nat -A POSTROUTING -s 192.168.88.0/24 -o venet0:0 -j MASQUERADE
# in OpenVZ/VServers you may need the following instead the lane above
iptables -t nat -A POSTROUTING -s 192.168.88.0/24 -j SNAT --to-source 22.214.171.124
After the upgrade Debian 7 to Debian 8 on OpenVZ platform on OVH the OpenVPN service stopped working. The problem was that the “TUN” device was missing, so the command below will temporary fix this problem.
root# mkdir -p /dev/net
root# mknod /dev/net/tun c 10 200
root# chmod 600 /dev/net/tun
Also you can add this to a script at start up.
Just run this script 🙂
find HR Operations| while read NAME; do stats=`stat --format "%n;%y;%s;%U" "$NAME"`; rightss=`rights -f "$NAME" show|grep -i "CN="|tr 'n' ' '`; echo "$stats;$rightss"; done > "HR_Operations.csv"
The filename and pathname lengths are limited; constants defined in linux/limits.h
#define NAME_MAX 255 /* # chars in a file name */
#define PATH_MAX 4096 /* # chars in a path name including nul */
nbfs1:~ # getconf NAME_MAX /
nbfs1:~ # getconf PATH_MAX /
The simplest way to send a file as a mail attachment is shown by the following examples:
# uuencode snoopy1.jpeg snoopy1.jpeg | mail email@example.com
If user uses a current mail reader like Mozilla, Netscape Messenger or Microsoft Exchange, she/he will see a mail containing just one file attachment: the file “snoopy1.jpeg”.
This way we can include text, too:
# (cat mailtext; uuencode snoopy1.jpeg snoopy1.jpeg) | mail firstname.lastname@example.org
The file called “snoopy1.jpeg” again appears twice on the uuencode command line: the first time to specify the input file name, the second time for the remote extraction file name.
echo -e "text in line1 ntext in line2"| mail -s "Subject of an e-mail" -r "User1<email@example.com>" -a "/tmp/abc.zip" firstname.lastname@example.org
A lot of times all people need is a quick reference, so I’ll start with a reference of vi/vim delete commands:
x – delete current character
dw – delete current word
dd – delete current line
5dd – delete five lines
d$ – delete to end of line
d0 – delete to beginning of line
delete to beginning of file
delete to end of file
You can drop as IP address using the iptables command:
iptables -A INPUT -s 192.168.1.100 -j DROP
iptables -A OUTPUT -d 192.168.1.100 -j DROP
However, you can use route or ip command to a null route unwanted traffic. A null route is a network route or kernel routing table entry that goes nowhere.
route add 192.168.1.100 gw 127.0.0.1 lo
or reject 😉
route add -host 192.168.1.100 reject
Also we can drop entire subnet 192.168.1.0/24
route add -net 192.168.1.0/24 gw 127.0.0.1 lo
To delete an IP address or entire subnet from a null route use the following command:
route del 192.168.1.100 gw 127.0.0.1 lo
route del -net 192.168.1.0/24 gw 127.0.0.1 lo
route del -host 192.168.1.99 reject