Archive for the ‘ shell script ’ Category

Method 1: passwd

Conventionally the command use to change password on Linux based system is passwd
, the option related to this command is –stdin ,an this is all done throughout a pipe.
echo -e "new_password\nnew_password" | (passwd --stdin $USER)

Method 2: chpasswd

Another alternative is to use the chpasswd, explain as below:
echo "password:name" | chpasswd
Note that the first method can be use to change psssword on Samba based system:
echo -e "new_password\nnew_password" | (smbpasswd -a -s $USER)

#!/bin/bash
MAXSIZE=62
array1=(
q w e r t y u i o p a s d f g h j k l z x c v b n m Q W E R T Y U I O P A S D
F G H J K L Z X C V B N M 1 2 3 4 5 6 7 8 9 0 \! \@ \# \$ \% \^ \& \* \( \)
\! \@ \# \$ \% \^ \& \* \( \) \! \@ \# \$ \% \^ \& \* \( \) \! \@ \# \$ \%
)
MODNUM=${#array1[*]}
pwd_len=0
while [ $pwd_len -lt $MAXSIZE ]
do
index=$(($RANDOM%$MODNUM))
echo -n “${array1[$index]}”
((pwd_len++))
done
echo
exit 0

RPM and DEB packages are both containers for other files. An RPM is some sort of cpio archive. On the other hand, a DEB file is a pure ar archive. So, it should be possible to unpack their contents using standard archiving tools, regardless of your distribution’s package format. Under normal conditions, you should use your distribution’s standard package manager, rpm or dpkg and their frontends, to manage those files. But, if you need to be more generic, here is how to do it.
Read the rest of this entry

How to Recover Lost Data?

data-recovery310191219_std We need data recovery tools on daily basis. Once we lose very sensitive data, we get desperate to retrieve them at any cost. Data recovery is very delicate job. The key is that once you lose your data in a particular hard drive, please, do not copy or install anything on it. Leave the drive intact. Otherwise, you wouldn’t be able to recover data. Just make an image at a different location of your hard drive where you lost your data and use the data recovery tool on the image to recover data. There are quite a few good open source data recovery tool available in the market and Scrounge NTF is one of them. We are going to take a quick look of the tool.

Read the rest of this entry

How To Use Wget Through Proxy

Wget is a super-useful utility to download pages and automate all types of web related tasks. It works for HTTP as well as FTP URL’s. Here is a brief tutorial on how to use wget through proxy server.
Read the rest of this entry