Wednesday, 15 May 2013
Saturday, 11 May 2013
Managing password expiry for a user account (Unix/Linux)
I find this very useful on several occasions so here we go. Login as root and execute the following:
So if you want to remove password expiry from bob's account, type:
Notice that -1 parameter after -x represents number of days before the password expires. Since we do not want the password to expire, we have set it to -1. However, you can set it to any value you want. So, if you want your password to expire after 90 days (i.e. 3 months) for bob's account, type:
passwd -x -1
So if you want to remove password expiry from bob's account, type:
passwd -x -1 bob
Notice that -1 parameter after -x represents number of days before the password expires. Since we do not want the password to expire, we have set it to -1. However, you can set it to any value you want. So, if you want your password to expire after 90 days (i.e. 3 months) for bob's account, type:
passwd -x 90 bob
Tuesday, 7 May 2013
Checking memory (RAM) size on Solaris
If you want to check how much RAM your Solaris machine has, here's how:
You can also try:
/usr/sbin/prtdiag -v | grep -i memory
You can also try:
/usr/sbin/prtconf | grep -i memory
Friday, 3 May 2013
Writing Code - Building a chat application in Java - Session 1
Hey Guys! In this series, we will be building a chat application in java. I think this will be a great chance for you all guys out there wanting to do something hands on in Java.
Thursday, 2 May 2013
Removing password expiry from your unix machine (Linux and Solaris)
Here's a quick one. If you have a server and you do not want the password for a user to expire (as it can screw some things up while its active), you need to execute the following commands as
where is the username whose password expiry you wish to remove. For instance, in my case, if username is dm014, I executed:
root
:
passwd -x -1
where
passwd -x -1 dm014
I have tested this and it works flawlessly on linux and solaris.
Wednesday, 1 May 2013
Compiling C++ easily on Linux (Easy C++ build system)
I was developing some C++ stuff on my Linux virtual machine and wanted to create something that would make it easy for me to compile C++ code. So I wrote up some bash code and added it into .bashrc as a function. Here's the code:
function cpprun(){
echo "Checking if output directory exists..."
if [ ! -d "./output" ]; then
echo "Creating output directory..."
mkdir "./output"
echo "Output directory created."
elif [ -f "./output/cpprun.o" ]; then
echo "Backing up previous output..."
mv ./output/cpprun.o ./output/cpprun.bak.o
echo "Backup finished."
fi
echo "Running g++ compile..."
g++ -o ./output/cpprun.o *.cpp
if [ -f "./output/cpprun.o" ]; then
echo "Compile finished."
echo "Running output..."
echo "-----------------"
./output/cpprun.o
echo "-----------------"
echo "Run finished."
else
echo "Compile failed."
fi
}
Add this to your .bashrc script and then you should be able to compile your C++ code by typing cpprun in the base directory.
Subscribe to:
Posts (Atom)