It is easier than you think. Use the usermod command with root privileges. Following example will remove the user george from the root group.
$ sudo usermod -G root george
Referance: https://www.poftut.com/user-groups-linux/
It is very easy just put the script file path after the ssh command like below.
ssh [email protected] 'bash -s' < cat myscript.sh
Look: https://www.poftut.com/run-shell-script-command-remote-ssh/
There are different functions and ways to match a word in PHP. Best way is using preg_match() function. In the following example we will search the forum word in the $bigtext content.
preg_match('/forum/',$bigtext)
Look: https://www.poftut.com/check-string-contains-specific-word-php/
No. You shouldn’t write a bash script. Just use the cp command bulk copy feature and provide all files you want to copy and add the path which is the destination.
cp file1 file2 file3 /mnt/backup
Referece: https://www.poftut.com/linux-cp-or-copy-command/
There are different ways. You can also use the systemd but as you are asking for init.d use the following command.
sudo /etc/init.d/networking start
Reference: https://www.poftut.com/start-stop-restart-networking-linux/
You can use the Python command to get the Python interpreter version. For the default Python installation use
python -v
OR for Python2
python2 -v
Or Python3
python3 -v
Reference: https://www.poftut.com/find-python-version/
Python provides exists() function which can be used like below. Look https://www.poftut.com/check-whether-file-exists-using-python/ for more information.
import os.path
if(os.path.exists("/etc/passwd")):
print("/etc/passwd exists")
You have to download it from nessus web site and install it by using dpkg command and start the nessus service . reference : https://www.poftut.com/install-tenable-nessus-kali/ and https://docs.tenable.com/nessus/Content/InstallNessusLinux.htm
There are a lot of ways to list services in a linux or ubuntu system. But if you also want to list services status "systemctl list-units" will work for your case perfectly.
Ref: https://www.poftut.com/start-stop-get-status-linux-service-systemd/
Find command is very useful option here. You can search for files older then 1 month and delete them with -delete option.
$ find /tmp -mtime +7 -type f -name '*.tmp' -delete
https://www.poftut.com/how-to-remove-files-older-than-1-day-1-week-1-month-recursively/
There are a lot different ways to a process which is using given file. But fuser command can be used to list users who is using give n files. Fuser /home/john/test.txt will list processes wich opened test.txt file .
for more details: https://www.poftut.com/use-fuser-match-user-process/
Best way is using find command with the -exec option where you can use chmod.
$ find /my/bashfiles/ -type d -name *.c -exec chmod 770 {} \; read below: https://www.poftut.com/set-permission-folders-subfolders-linux/
Hi,
You can use read command in bash where input will be set into a bash variable. Read -p "What is your age" age in this example the user input value will be set into age.
Referance: https://www.poftut.com/prompt-input-bash/
You can use thre backslash or \\\ while specifying the path. scp my.cfg
root@localhost:/home/samuel/test\\\ 2/
referance :https://www.poftut.com/linux-scp-command-usage-with-examples/
You can use following command which can be used to list suid enabled files.
$ find / -perm /u=s
reference: https://www.poftut.com/linux-find-command-with-examples/
There are different ways to exclude and grep given a text file or input stream. I generally prefer the most basic one where use two grep where the first one is for exclude with -v option and pipe to second one where I grep for my string. grep -v 'able' config.txt | grep 'system' For more...