Solved

How to create a password file in CentOS

Posted on 2011-03-02
3
785 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Linux hostname change 2 71
Linux VM 6 88
CENTOS DHCP Server / PXE/TFTP 14 75
number in printf 13 27
If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

770 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