LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-29-2012, 03:54 AM   #1
LittleMaster
Member
 
Registered: Jun 2012
Posts: 121
Blog Entries: 1

Rep: Reputation: Disabled
Question cvs login: authorization failed:


Hi All,

I have tried to login normal user with CVS.but I cannt able to login as below .

[root@sherpa ~]# export CVSROOT=server:swami@10.x.xx.xx:/home/cvs/
[root@sherpa ~]# cvs login
Logging in to server:swami@10.x.xx.xx:2401/home/cvs
CVS password:
PAM authenticate error: Authentication failure
cvs login: authorization failed: server 10.x.xx.xx rejected access to /home/cvs for user swami.

Please do help ..

Last edited by LittleMaster; 11-30-2012 at 12:03 AM.
 
Old 11-29-2012, 08:59 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Do you have a file
Code:
.cvspass
in your home directory; it's not there by default, you have to create it. It should have this permission mask:
Code:
ls -l .cvspass
-rw------- 1 trona users 182 Mar 18  2011 .cvspass
It's content looks like
Code:
cat .cvspass
/1 :pserver:trona@fubar.com:2401/usr/local/cvsroot A%y!4Kw1"
/1 :pserver:trona@snafu.com:2401/usr/local/cvsroot A%y!4Kw1"
/1 :pserver:trona@pita.com:2401/usr/local/cvsroot A%y!4Kw1"
The above allows me access to CVS on three different servers. Those lines are put in the file by a successful CVS login.

You may be able to stop here -- just add the .cvspass file to your home directory and see if that works for you. If it does, great. If not, try the stuff below.

Do you have a password file in /usr/local/cvsroot/CVSROOT/passwd (or wherever your cvsroot is); it's not there by default, you have to have created it to use CVS passwords.

The passwd file has the structure
Code:
user:encrypted
You can add user names and encrypted passwords to that file with a text editor:
Code:
su -
vi /usr/local/cvsroot/CVSROOT/passwd
Where can you get the encrypted password? Ah-ha! Two ways: copy the user's password from /etc/shadow or generate one with a little program listed below.

A user password in /etc/shadow looks like this:
[code]
su -
grep joey /etc/shadow
joeytest:$1$1f7yM/VX$rxAEdKoFUD32GaHnsLehp/:15522:0:99999:7:::
Code:
All you want in /usr/local/cvsroot/CVSROOT/passwd is the first two fields:
Code:
su -
grep joeytest /etc/shadow | awk 'BEGIN { FS=":" } { printf ("%s:%s\n", $1, $2); }' >> /usr/local/cvsroot/CVSROOT/passwd
Obviously you could simply [code grep joey /etc/shadow >> /usr/local/cvsroot/CVSROOT/passwd
then use an editor to delete :15522:0:99999:7::: from the end of the line.

Downside of this is that you have to redo it every time the user's login password are changed, not good, better to have a separate CVS password.

That's where this little utility, cvspas.c, comes in:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <pwd.h>
#include <time.h>
#define	_XOPEN_SOURCE
#include <unistd.h>

extern	char	*crypt	(const char *, const char *);

void	main	(int argc, char *argv [])
{
	char	salt [3];
	char	*passwd, *encryptedpw;
	char	*user;
	int	i;

	/*	seed the random number generator	*/
	srand ((int) time ((time_t *) NULL));
	/*
	 *	we need two random numbers in the range
	 *	>= 65 <= 90 or >= 97 <= 122 (that's A - Z
	 *	or a - z inclusive) for the salt characters
	*/
	while ((i = rand()) < 65 ||
		i > 90 && i < 97 ||
		i > 122)
		;
	salt [0] = i;
	while ((i = rand()) < 65 ||
		i > 90 && i < 97 ||
		i > 122)
		;
	salt [1] = i;
	salt [2] = '\0';
	/*	find out who we are			*/
	if ((user = getenv ("USER")) == (char *) NULL) {
		(void) fprintf (stderr,
		    "%s:\tunable to determine user id\n",
		    argv [0]);
		exit (EXIT_FAILURE);
	}
	/*	ask for the password			*/
	passwd = getpass ("Password to encrypt: ");
	/*	crypt() only looks at the first two characters of salt	*/
	encryptedpw = crypt (passwd, salt);
	(void) fprintf (stdout, "%s:%s\n", user, encryptedpw);
	exit (EXIT_SUCCESS);
}
Save that as cvspas.c then
Code:
cc -s -o cvspas cvspas.c -lcrypt
When you execute it
Code:
cvspas
Password to encrypt: somepassword
trona:gUUk8pzizPmCQ
You won't see what you type for "somepassword" and the output will be the user ID you're using when you run it. Advantage of this? That line can be repeated for every CVS user with the "cvspassword" you typed; just paste as many copies of the output as need and edit the user names, something like this
Code:
fred:gUUk8pzizPmCQ
bill:gUUk8pzizPmCQ
sally:gUUk8pzizPmCQ
janet:gUUk8pzizPmCQ
Everybody in a particular group has the same CVS password (which may not be desired) or you can simply execute cvspas multiple times with different passwords, copy, paste and edit -- (cvspas will not repeat a password encryption on multiple runs. Keep in mind that only root can edit /usr/local/cvsroot/CVSROOT/passwd.

Now I must apologize right here that I don't know diddly-squat about PAM or what if anything you have to do with PAM to have CVS useful. All the above has been used on Solaris and multiple Linux distributions with no problems... but none of them used PAM, so I dunno from here. I hope this works for you.

Hope this helps some.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
svn:Authorization failed jnovice Linux - Server 2 08-25-2010 12:35 AM
cvs login: authorization failed lkapoor Linux - Newbie 2 10-31-2007 11:29 AM
Problem Encounterd : cvs [login aborted]: authorization failed. SianZronG Linux - Enterprise 3 02-26-2007 08:23 PM
CVS Login: Authorization Failed nestorjb Linux - Newbie 7 02-14-2007 04:18 PM
Authorization Failed Poskus Fedora 1 02-23-2004 08:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration