svn setup permission issues - linux

I'm having trouble setting up my svn. I used apt-get install subversion to install the software. The default svn folder was /home/svn/ I changed the ownership of the folder to an administrator account (not root) and a subversion user group I setup. I set the folder permissions to 0760 recursively through all the subfolders.
Yet whenever I try connecting to the repo I get this: "Commit failed (details follow):
Can't open file '/home/svn/bftc/format': Permission denied".
I have no idea what's wrong!

Make sure your user has execute permission on any folder. 770 should work for you (as Newton Falls pointed out) as this will allow group execute.

If your svn repository is owned by a group that you are not in, then 770 will not work. You have to be part of the group, or change permissions to 777. The former is preferable.

How have you set up the repository access? Does your user have permissions to access your repository? If it is via the svn access file you may want to check the user permissions.

Related

Should we use sudo for git operations?

What is the difference between the following two command lines?
root#superhero:~/Workspace/# sudo git push origin master
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
root#superhero:~/Workspace/# git push origin master
Everything up-to-date
Using sudo causes the command to run as the root user. The Git command uses credentials and configuration stored in the current user's home directory; when you run as sudo, this code is going to be looking at the root home directory, not your home directory and thus miss this context.
In most cases, it should not be necessary to use sudo. There are very few cases where it is required (such as installing software globally such as with apt-get) and when it comes to programming, use of sudo is often but not always an anti-pattern (in order to ensure that source code is hermetic and reproducable, most software should be installed in the repository, not globally).
When you are using sudo in your command. This is the root user that execute the command. The key used to access to your git server are store in a directory (.ssh/). When you run the command in root. The directory is the '.ssh/' of root so not the good one.
Another point, with sudo, this is a user from sudo group that execute the command. So the sudo group does not have access to your.ssh

Use a git repository on /var/www/html/

I am making a web tool and hosting this project on Github. I want to create a repository on my machine (running linux) being able to easily test it on local.
I can test it without problems on /var/www/html (already have apache and php set up), but I am having trouble creating a repository there. However, if I try to create the repo in ~/Documents/Github/PROJECT_NAME it works perfectly; but I can't test my project from there.
How can I create a repo inside /var/www/html where I can put my project files and run them locally without problems?
I tried to run sudo git init then sudo git clone git#github.com:xxx/xxx.git (that is how I clone my repo on ~/Documents/Github/PROJECT_NAME, so I have already exchanged SSH keys with Github) but it didn't work:
Cloning into 'PrerequisiteVisualizer'...
Warning: Permanently added the RSA host key for IP address '192.30.252.129' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
EDIT: I am able to run without problems
mkdir ~/Desktop/TESTING
cd ~/Desktop/TESTING
git init
git clone git#github....
My question is similar to Attempting to use symbolic link for var/www/html but it still is different.
EDIT2: I think I need to clarify why the thread I cited isnt what I am looking for. I saw the solution proposed there but note that, as long as I understood the other thread, they created a directory in his home (~) and made it accessible locally using the per-user web directories. But this is not what I want to do. I just want to "create a repo inside /var/www/html", not in anywhere else.
The problem isn't strictly with /var/www/html, it's with sudo. If you use sudo to do git, you are running it as a different user, which doesn't have access to your private ssh credentials (nor should it have).
In the other thread you pointed to there's an explanation of per user www directories, which should be one way of solving your problem. If it doesn't, you could amend the question with reasoning why it doesn't.
Update: based on the discussion, you want all content within /var/www/html owned by the user operating git repository. That you should be able to do in the way proposed by #rogerovo in a comment to this answer:
sudo chown -R _currentuser_:www-data /var/www/html && chmod -R g+sw /var/www/html
Permissions for /var/www/html folder needs to be changed.
Kindly run this command sudo chmod o+w /var/www/html to give write access to everyone.
Once run, you should be able to transfer files in /var/www/html folder.

Linux: Allow one user to manage all files from another user/group

I just installed lamp-server^ on my home linux machine.
Now I created a new folder project with files in the /var/www/ directory (server root directory). I set the owner user/group to www-data via sudo.
Now I want to access the folder and its files via cd or normally via the file explorer, but I get the error that I haven't the permission to do/access that folder or its files (with my normal user account).
Is it possible to give my user account the rights to access/modify the project folder?
you can either
a+rwx the directory or
include yourself in that group, but from your question, it seems you don't want to do that. it would be more secure than allowing anyone to read, write and execute that dir.
Yes it is possible. Just add your user in www-data group.
useradd -G www-data {your_username}

SVN Commit error: Can't open file txn-current-lock Permission denied

I can do checkouts, update and such. But when I try to commit changes, SVN gives me the following error:
Can't open file '/svn/p/pokemonium/code/db/txn-current-lock': Permission denied
I am using Windows 7 x64 SP1 with latest version of TortoiseSVN.
UAC is off, my account has read and write access, etc.
I can commit fine to other svn repositorys.
For me it ended up being a permissions issue on the server. I have my repo on a linux box, and ssh in to use svnadmin. For convenience sake, I had executed my create repository command as root. I was looking to get source I had on my Windows box into the repo, so was using TortoiseSVN to set up trunk/branches/tags. The directory containing the repo on the server was owned by root, and Tortoise was coming in as apache. I chowned the directory on the server to apache:apache, and it all went smoothly.
chown apache:apache -R my_repo_root
This is a server configuration issue. On windows host Visual SVN server runs under NETWORK SERVICE account by default. I solved this problem by granting full access rights to the repository folder to this account. Another option is switching Visual SVN service to the SYSTEM account, but that could pose a potential security risk.
Try this.
Make a back up copy of your working copy (just to be safe).
Make another copy your entire working copy off somewhere else.
Take the copy and delete all of the SVN folders out of it
Delete your working copy and do a fresh checkout
now copy/paste your corrupted working copy over your fresh checkout.
it is critical for this to work that you have completely removed ever _svn or .svn folder from your corrupted working copy before you perform the copy/paste.
This will leave you (hopefully) with a working copy that shows (!) on all the files you had modified since your last commit. And fixes your lock issue.
I had the same problem after I re-installed Windows 7 and just copied the SVN Repository from the old Windows to the new one.
After trying the steps that Mr. Manager proposed, the problem was still not fixed in my case.
After making sure that the permissions was setup correctly for the SVN Repository folder I just deleted the file 'txn-current-lock' in the /db folder of the project. That fixed it for me. From thereon I could commit my project again.
I had faced same issue on Unix box
Restarting the Apache service of the SVN server solved myproblem.
-f httpd.conf -k stop
-f httpd.conf -k start
In my own case, my linux server had been restarted after a power loss. The file system remained mounted as read-only since some journal repairs had been made. Rebooting the machine restored full function.
permissions worked for me too
error
repo/db/txn-current-lock: Permission denied
fix
chown apache:apache -R my_repo_root

CVS Error: failed to create lock directory... Permission denied

I'm using using TortoiseCVS to access the CVS server. I get the following error:
In D:\source\foo: "C:\Program Files\CVSNT\cvs.exe" -q update -P -d
CVSROOT=:ssh:annan#foo-bar.co.uk:/home/cvsroot
cvs update: failed to create lock directory for `/home/cvsroot/foo' (/var/lock/cvs/foo/#cvs.lock): Permission denied
cvs update: failed to obtain dir lock in repository `/home/cvsroot/foo'
cvs [update aborted]: read lock failed - giving up
Error, CVS operation failed
I had this problem before and managed to fix it, however this time I've not been able to figure it out. I believe it's related to different people committing files with their own ownership.
After reading a few articles online I've tried changing /home/cvsroot and /home/cvsroot/foo to 777 permissions, and recursively changing the ownership of /home/cvsroot/ to cvs:cvs (of which I am a member).
The lock file is being created in /var/lock/cvs/foo/ you should check the permissions of that directory.
Make sure the checkout repository has the permission to checkin the files.
I have checkout the directory
cvs -d #cvs:/files/cvs co vcommon
But this rep doesnt have permission to checkin the files in the package folder.
Problem solved by checking out below:
cvs -d #cvs:/files/cvs/vcommon co package
I had an issue where my account had not been added to the "users" group. So even though permissions looked good, I still wasn't able to checkout any repositories. Once I was added to the users group, it fixed everything.

Resources