Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to create a password file in CentOS

Posted on 2011-03-02
3
Medium Priority
?
863 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

609 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