Solved

How to create a password file in CentOS

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
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 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.:
Suggested Courses

732 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