SVN: Force svn daemon to run under different user - linux

I have a small NAS server (QNAP TS-210) with a limited Linux on-board. I have problems running hooks in my local SVN daemon. If I run them directly, from command-line, all is OK. If SVN try to run them as hook or if they're added to crontab and then CRON tries to run them, both fails.
I was told that this is due to difference between users running these scripts / hooks. I'm logging to my nas via SSH as "admin" and assume that both CRON and SVN are run under "root". Seems that root hasn't got enough privileges for destination folder (I use SVN post-commit-hook to export repository to some local folder) or to run SVN / CRON (SVN also fails on pre-revprop-change hook, even if it contains only exit 0, so I assume that SVN can't run hooks at all). Or maybe this is something different?
EDIT: How can force SVN to run under "admin" or how can I set enough privileges for "root", so it can run SVN hooks just as I can ("admin")?
EDIT: My hook script is in /share/Sys/svn/tools_and_examples/hooks so, calling
ls -lh /share/Sys/svn/tools_and_examples/hooks
results this:
-rwxrwx--x 1 trejder everyone 147 Jun 24 14:33 post-commit.cron*
-rw-rw---- 1 admin administ 1.9k Jun 25 12:20 post-commit.tmpl
-rw-rw---- 1 admin administ 1.6k Jun 25 12:20 post-lock.tmpl
-rw-rw---- 1 admin administ 2.2k Jun 25 12:20 post-revprop-change.tmpl
-rw-rw---- 1 admin administ 1.5k Jun 25 12:20 post-unlock.tmpl
-rw-rw---- 1 admin administ 3.3k Jun 25 12:20 pre-commit.tmpl
-rw-rw---- 1 admin administ 2.4k Jun 25 12:20 pre-lock.tmpl
-rw-rw---- 1 admin administ 6 Jun 25 12:29 pre-revprop-change
-rw-rw---- 1 admin administ 2.1k Jun 25 12:20 pre-unlock.tmpl
-rw-rw---- 1 admin administ 2.7k Jun 25 12:20 start-commit.tmpl
and ls -lh /share/Sys/svn/tools_and_examples/hooks/post-commit.cron gaves me this:
-rwxrwx--x 1 trejder everyone 147 Jun 24 14:33 /share/Sys/svn/tools_and_examples/hooks/post-commit.cron*
Hope, this will help.

for a cron being launched as admin, instead of editing
/etc/crontab
you should use
crontab -e
logged in as admin and put whatever command/script you want to be launched by admin with its own crontab. If I'm not wrong, it should launch it as the "admin" user

Related

Touch command. permission denied

I was able to connect to my school server via SSH. I had an assignment in which I was supposed to use the touch command to create a new file. Yet it keeps returning permission denied. Others were able to do the same thing. Though why do I keep getting this error?
Below is what was the input from the terminal.
Last login: Tue Aug 23 09:16:18 on ttys000
Dominiks-Air:~ fsociety95$ ssh djaneka1#navajo.dtcc.edu
djaneka1#navajo.dtcc.edu's password:
Last login: Tue Aug 23 09:16:35 2016 from pool-72-94-210-193.phlapa.fios.verizon.net
Navajo is Linux shell server provided to staff, faculty, and students. The
operating system is RedHat Enterprise Linux 5.
Alpine, a Pine replacement, has been provided as a mail client. Run "pine"
at the command prompt.
This server also provides web space to users. Web pages can be stored in
the ~/www directory. This is also accessible by mapping a drive in Windows
to \navajo\homepage. The URL for your homepage is
http://user.dtcc.edu/~username/.
Your home directory is also accessible in Windows by mapping to
\navajo\.
If something appears broken or missing, please email path#dtcc.edu.
Could not chdir to home directory /u/d/j/djaneka1: No such file or directory
-bash-3.2$ touch today
touch: cannot touch `today': Permission denied
-bash-3.2$ pwd
/
-bash-3.2$ touch today
touch: cannot touch `today': Permission denied
-bash-3.2$
Edit: here is the result of ls -al
-bash-3.2$ ls -al
total 204
drwxr-xr-x 25 root root 4096 Aug 22 16:50 .
drwxr-xr-x 25 root root 4096 Aug 22 16:50 ..
-rw-r--r-- 1 root root 0 Aug 3 14:01 .autofsck
-rw-r--r-- 1 root root 0 Jan 30 2009 .autorelabel
-rw------- 1 root root 2050 Aug 3 14:00 .bash_history
drwxr-xr-x 2 root root 4096 May 4 04:14 bin
drwxr-xr-x 4 root root 3072 Aug 3 13:57 boot
drwxr-xr-x 11 root root 4060 Aug 3 14:02 dev
drwxr-xr-x 87 root root 12288 Aug 23 10:05 etc
drwxr-xr-x 3 root root 4096 Oct 1 2009 home
drwxr-xr-x 13 root root 12288 Jun 1 04:09 lib
drwx------ 2 root root 16384 Mar 24 2008 lost+found
drwxr-xr-x 3 root root 4096 Oct 1 2009 media
drwxr-xr-x 2 root root 0 Aug 3 14:02 misc
drwxr-xr-x 4 root root 4096 May 26 2012 mnt
drwxr-xr-x 2 root root 0 Aug 3 14:02 net
drwxr-xr-x 9 root root 4096 Jan 5 2009 nsr
drwxrwxr-x 3 root root 4096 Oct 12 2015 opt
dr-xr-xr-x 219 root root 0 Aug 3 14:01 proc
drwxr-x--- 12 root root 4096 Apr 22 10:06 root
drwxr-xr-x 2 root root 12288 Aug 4 04:02 sbin
drwxr-xr-x 2 root root 4096 Oct 1 2009 selinux
drwxr-xr-x 2 root root 4096 Oct 1 2009 srv
drwxr-xr-x 11 root root 0 Aug 3 14:01 sys
drwxrwxrwt 38 root root 4096 Aug 23 10:07 tmp
drwxr-xr-x 34 root root 4096 Jun 21 08:29 u
drwxr-xr-x 14 root root 4096 Apr 16 2010 usr
drwxr-xr-x 24 root root 4096 Apr 16 2010 var
-rw------- 1 root root 2865 Dec 16 2008 .viminfo
-bash-3.2$
EDIT:
Here is what I see after trying touch today in /home
So to try and create a new document in the root directory you need to be recognised as root. That means using the sudo command.
However for that you would need a password that you may not have. If you do perfect. But in any case I would not recommend adding files to the root directory.
Instead try the following:
cd home
touch today
This should work just fine and answer your question.
Still if you need/want to create today in your root directory try the following
sudo touch today
You will then be prompted for the root password that you can type (if you have it obviously)
In any case I suggest reading this which may be very helpful for you.
I wonder if this was ever truly answered.
If I was looking at it, I would try to see what the system thinks is the home directory of djaneka1, since it may have been setup partway and not completed, leaving stuff owned by root that should have been owned by djaneka1.
If you use the pwd command, and get back the "/" (root) directory there is something wrong with your setup.
The message: Could not chdir to home directory /u/d/j/djaneka1: No such file or directory
tells you it can't find your home directory.
-bash-3.2$ pwd
/
the command "pwd" revealing "/" is just an artifact of the system not being able to find your home directory.
To find what the system thinks is one's home directory,
one can search the file named '/etc/passwd' for one's login name.
I expect this is a possible result if you do that:
$ fgrep 'djaneka1' /etc/passwd
djaneka1:x:1505:1506::/u/d/j/djaneka1:/bin/bash
since it complained that it couldn't find that directory.
This needs to be fixed by someone who has more rights to the system, like root.
there is nothing djaneka1 can do a

How to use gitolite public & private key pair generated for windows in linux in virtual box?

I have generated public and private key pair for git in windows and it is working fine in windows. And I tried to use the same key pair in linux in virtual box by copying the .ssh folder to ~/.ssh folder of linux.
Now when I try to perform git commands like clone, fetch in linux it is asking for password. I haven't specified any password for this. How to resolve this?
Thanks in advance.
Here is my : ls -la ~/.ssh
user#g3gdev-user:~$ ls -la ~/.ssh
total 28
drwxrwxrwx 2 user user 4096 Jun 21 11:07 .
drwxr-xr-x 43 user user 4096 Jun 23 10:59 ..
-rwxr-xr-x 1 root root 1464 Jun 21 11:05 git_key.ppk
-rw------- 1 user user 1464 Jun 21 11:05 git_new_key.ppk
-rwx------ 1 user user 1675 Jun 21 11:05 id_rsa
-rw------- 1 user user 400 Jun 21 11:05 id_rsa.pub
-rwxrwxrwx 1 user user 415 Jun 21 11:05 known_hosts
May be you have to open the generated key in puttyGen, and then go to Conversion, then Export to openSSH. Use this openSSH for your linux systems. There is a small difference between openssh and ssh.

Should I mess with file permissions in the Jenkins home directory?

Looking in /var/lib/jenkins on a relatively fresh install, I notice some file permissions that are, well, scary:
-rw-r--r-- 1 jenkins jenkins 7285 Apr 29 13:29 config.xml
-rw-r--r-- 1 jenkins jenkins 4008 Apr 28 21:04 credentials.xml
-rw-r--r-- 1 jenkins jenkins 64 Apr 28 13:57 secret.key
And in /var/lib/jenkins/secrets:
-rw-r--r-- 1 jenkins jenkins 272 Apr 28 15:08 hudson.console.AnnotatedLargeText.consoleAnnotator
-rw-r--r-- 1 jenkins jenkins 32 Apr 28 15:08 hudson.model.Job.serverCookie
-rw-r--r-- 1 jenkins jenkins 272 Apr 28 14:25 hudson.util.Secret
-rw-r--r-- 1 jenkins jenkins 32 Apr 28 13:57 jenkins.model.Jenkins.crumbSalt
-rw-r--r-- 1 jenkins jenkins 48 Apr 28 14:25 jenkins.security.ApiTokenProperty.seed
-rw-r--r-- 1 jenkins jenkins 256 Apr 28 13:57 master.key
-rw-r--r-- 1 jenkins jenkins 272 Apr 28 13:57 org.jenkinsci.main.modules.instance_identity.InstanceIdentity.KEY
-rw-r--r-- 1 jenkins jenkins 5 Apr 29 13:29 slave-to-master-security-kill-switch
I'm thinking all these files should be set to mode 600 with owner jenkins, but I'm not sure if I'm being paranoid. Is there some reason why the maintainers haven't locked these files down more? Is there some other well-protected master key that makes these files by themselves less valuable?
The above permissions seems standard across all Jenkins. Changing the permissions have messed up the set up for me in the past.

Log file permissions in Oracle WebLogic

I have changed the startWeblogic.sh script to give read access to the log files.
Here are examples:
-rw-r--r--. 1 oracle oinstall 81586 Apr 15 22:43 access.log
-rw-r--r--. 1 oracle oinstall 700087 Apr 15 22:45 localhost.log
-rw-r-----. 1 oracle oinstall 20553 Apr 15 22:49 localhost.out
From the above other users got read permissions for access.log and localhost.log, but its not assigning read access to localhost.out log file. Please suggest which configuration file to change.
set umask 022 in startweblogic.sh and startnodemanager.sh and wlscontrol.sh worked

Can't CD to directory inside of root

I am currently creating an application that requires separate users running duplicate programs. They cannot run under root because of security reasons, so they are initiated by a Java app that I am working on, and I am starting them with runuser -l. However, I cannot cd into a directory, even though it is owned by the user, and the user has 770 permissions in the folder.
Here's what I'm running:
runuser -l lp1 -c 'java \-jar /root/Desktop/workspace/LitePanel/servers/server1/server.jar \-Xms1024M nogui'
And the output of this is:
runuser: warning: cannot change directory to /root/Desktop/workspace/LitePanel/bin/servers/server1/: Permission denied
Here's an ls -all:
drwxr-xr-x. 3 root root 4096 Jan 30 14:03 .
drwxr-xr-x. 7 root root 4096 Jan 30 14:02 ..
drwxrwx---. 2 lp1 lp1 4096 Jan 31 03:07 server1
Inside the directory:
drwxrwx---. 2 lp1 lp1 4096 Jan 31 03:07 .
drwxr-xr-x. 3 root root 4096 Jan 30 14:03 ..
-rwxrwx---. 1 lp1 lp1 9170551 Jan 31 03:07 server.jar
And here's /etc/passwd:
lp1:x:501:501::/root/Desktop/workspace/LitePanel/bin/servers/server1/:/bin/false
Anyone know why this is happening? It looks like the user has the necessary permissions to do this.
You have said that the directory itself has permissions 770 and is owned by the user, but what about its parents? I believe the cd command will need at least read access (and possibly execute) on the parent directories.

Resources