Solved

How to create a password file in CentOS

Posted on 2011-03-02
3
787 Views
Last Modified: 2012-05-11
Hello,
Can someone please tell me how I can create a password file in CentOS?

Heres a little history of the issue. My domain has a minimum password length of 14 characters with complexity. I am trying to create a cifs share in CentOS that will map a CentOS directory to a Windows share. For some reason, when I try to mount the windows share, it says that the Password is too long and does not allow me to create the mount because it does not authenticate the user. I have heard in other articles that there is a way to overcome this by creating a password file and referencing that file in the mount command on CentOS. Any suggestions? I would like to see the commands on how to create the password file and what should be included in the mount command to finally mount the windows share.

Thank you..
0
Comment
Question by:serg2626
  • 2
3 Comments
 
LVL 20

Expert Comment

by:edster9999
ID: 35021515
The password file is plain text.
Uggghhhhh.  Sorry I shuddered just thinking about that.

In the mount command you would put something like

credentials=/root/cifspasswd

The plain text file then conatins :
username=value
password=value

so you could creat the file by doing :
echo "username=serg2626" > /root/cifspasswd
echo "password=MySecRet#PassWord999" >> /root/cifspasswd

The bad news is that is pretty much as secure as it gets.  Your login password just sigging in a file.
You should of course set the rights on the file so only you (root) can read it
chmod 400  /root/cifspasswd

0
 

Author Comment

by:serg2626
ID: 35021756
Can you give me the full mount command that I would enter. Assume that the target linux directory is called "backups" and the windows share is called "\\test\share".

Thank you again..
0
 
LVL 20

Accepted Solution

by:
edster9999 earned 500 total points
ID: 35022106
From memory it is something like :

mount -t cifs //test/share -o credentials=/root/.cifspasswd /mnt/backup

I have not mounted one like that for a long time.  I do have some old lines in my fstab file you can see :

you can do it in /etc/fstab with something like :

//test/share    /mnt/backups       cifs    credentials=/root/.cifspasswd 0 0

You could get a bit more fancy by adding which user and group to pretend to be in the linux system and what rights to set on files or directories it finds :

//test/share    /mnt/backups       cifs    credentials=/root/.cifspasswd,uid=backupuser,gid=backupgroup,filemode=640,dirmode=750 0 0

0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

766 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question