If two accounts have the same user ID, then by definition they are the same account. It is possible, but not recommended, to have more than one line in /etc/passwd
(or other user database) with the same user ID; they are the same user, with different ways to log in.
You were using an unsupported feature. The risk of using an unsupported feature is that it sometimes breaks when the system is upgraded.
Expiring password is usually bad for security, as it causes users to choose weaker passwords or write them down on a post-it note stuck to the monitor. The only security benefit to expiring passwords is to eventually lock out abandonned accounts. Since the abc account is presumably one that you use as part of some kind of regular task, don't expire it.
You should probably change this setup, as it's fragile. What to change it do depends on what you use the abc account for (who has the password, in what circumstances it's used, what's abc's shell, is it present on multiple machines, …).
I generally use the automount
service for shares like this that I'll periodically want to mount and use. Setting this up, once you understand how, is fairly trivial.
Step #1 - setup automounting
You'll need to make sure that packages are installed. On CentOS 6 that would be autofs
. Most likely other distros will use a similar name. You'll then need to create the following files:
# /etc/auto.master
/mymountpt /etc/auto.mymountpt --timeout=600 --ghost
# /etc/auto.mymountpt
someshare -fstype=cifs,rw,noperm,netbiosname=${HOST},credentials=/etc/credentials.txt ://cifsserver/sharename
# /etc/credentials.txt
username=mydom\myuser
password=somepassword
You'll need to make the permissions on this last file like so:
$ sudo chmod 600 /etc/credentials.txt
You'll also need to make sure that NSS (Name Service Switch) is aware of this setup:
# /etc/nsswitch.conf
automount: files nisplus
With these files in place you should now be able to start the autofs
service.
$ sudo service autofs start
Step #2 - testing it out
Once the service has been started, you'll be able to access this path at will:
$ cd /mymountpt/someshare
The mounting of this share is now governed by autofs
which will watch for 600 seconds of inactivity, at which point it will unmount the share.
This approach may seem a bit heavy handed but by doing things this way, you've alleviated your system from having to be dependent on a particular CIFS share as being available at boot. You've moved it so that it's now on demand when it's actually being used.
What to do if you don't have root login?
If you find you don't have these packages installed and aren't able to install them then your options become far fewer.
I would take a look at the Samba article in the ArchLinux Wiki, it covers other methods as well. You could also make use of FUSE to mount a variety of types of media as local directories, including SMB/CIFS. This is covered in the FUSESmb article on the Ubuntu Wiki.
References
Best Answer
You can use the mkpasswd tool to do this. There's a good primer on how to use it over on cyberciti.biz, titled: Linux / UNIX: Generating random password with mkpasswd.
Example
The package is usually called
makepasswd
, but the tool is typically calledmkpasswd
.See the man page for more details.
Generating contents of
/etc/shadow
directlyThe following python command will generate the portion that goes into the
/etc/shadow
file:Python
Perl
Which generates the following output:
Changing the /etc/shadow
Here's a command that will change the existing entry with the newly generated password field from the command above.
NOTE: This is a rough example but works. You'll need to take the results from the command that generated the hashed password, and escape the dollar signs ($) with slashes (\$).
The results are stored in a new file /etc/shadow.new. Once you've confirmed the results you can replace
/etc/shadow
with the new file,/etc/shadow.new
.