Ensure that there's no process running by the user you're modifying.
ps aux|grep oldname should show you only one result which is grep itself.
Login to root or use any other sudo user (you can't change name of the user you currently logged in, as login itself is a process),
usermod -l newname oldname
This doesn't change home directory, thus, do it via
usermod -d /home/newname -m newname
Subscribe to acsrujan
Get the latest posts delivered right to your inbox