BASH script to handle "authentication realm" - authentication

I have multiple SVN repositories which I intend to synchronize with other SVN server each night using svnsync like this:
svnsync synchronize --source-username my_server_user_name --source-password ... --sync-username dest_server_user_name --sync-password ... svn://dest_svn_server/svn/[repository_name]
But it fails with "Authentication realm" error and asks to enter login-password - when I enter dest_server_user_name-password again - it succeeds.
Is there a way to do it automatically somehow?
Thank you.

I found two ways to fix it:
1. Run svnsync with --non-interactive flag
2. Set property store-plaintext-passwords to yes within file ~/.subversion/servers

Related

Not able to switch to super user in terminal From robot framework

Open Connection 192.***.***.**
Login **** *******
Start Command su hdfs
Execute Command cd /home/rajesh/hive-latest/
${STDOUT1} Execute Command ls -lrt
Log ${STDOUT1}
Close Connection
*Here i am able to login. after login, not able to switch to super user. without switching to super user, its executing ls -lrt. Please help me with this if anyone knows
This is not how the ssh library works. Have a look at the documentation
The command is always executed in a new shell. Thus possible changes
to the environment (e.g. changing working directory) are not visible
to the later keywords
You can work around this by executing the command as different user, or if possible you can open another connection and login as desired user.
su - <username> -c "<commands>"

Is there a way of adding username and password into the bzr checkout command?

I'm trying to automate an install process using bash, the following Bazaar command are part of this:
bzr export /home/path bzr+https://adress
bzr checkout bzr+https://address/ /home/path
After running these commands manually I'm prompted for username and password.
Is there any way of adding username and password directly into the commands in order to avoid the prompting?
Checked the Bazaar documentation, but couldn't find a solution.
The standard format for HTTP URLs can be used to pass a username/password combination:
$ bzr checkout bzr+https://username:password#host/path /local/path
Another option would be to add your credentials to ~/.config/bazaar/authentication.conf. See this page for details: http://doc.bazaar.canonical.com/beta/en/user-reference/authentication-help.html

Jenkins CLI exception: missing Job/ExtendedRead permission

I have a Jenkins user that I want to give rights to run the remote CLI towards the Jenkins instance. The first command is to fetch the config.xml:
java -jar jenkins-cli.jar -s http://jenkins:8080/hudson get-job thejob
However when he invokes the command, it fails with:
Caught: java.lang.RuntimeException: \
hudson.security.AccessDeniedException2: \
USER is missing the Job/ExtendedRead permission \
at hudson.security.ACL.checkPermission(ACL.java:54)
I have given the rights to execute scripts, read/create/configure jobs and more in our matrix-based security grid. There is another user who has EXACTLY the same permissions in the grid, but for this other user, everything works fine.
I don't have any of the plugins 'Extended Read permission' or 'Read-only configurations' installed.
I cannot see why it fails for this new user. Suggestions anyone?
Differences in the 2 users config.xml file:
<com.cloudbees.plugins.credentials.UserCredentialsProvider_-UserCredentialsProperty plugin="credentials#1.4">
<credentials/>
vs:
<com.cloudbees.plugins.credentials.UserCredentialsProvider_-UserCredentialsProperty plugin="credentials#1.8.3">
<domainCredentialsMap class="hudson.util.CopyOnWriteMap$Hash"/>
And a final one:
<hudson.security.HudsonPrivateSecurityRealm_-Details>
<passwordHash>some values...</passwordHash>
</hudson.security.HudsonPrivateSecurityRealm_-Details>
I don't know if you are facing the same problem I had, but take a look here:
Jenkins CLI: using Anonymous permissions instead of the user defined ones
It looks like you have upgraded the credentials plugin but somehow the first user didn't get its record updated.
If you can I would suggest trying to update to the latest (1.9.1 for me). You could also edit the user record manually and force the real plugin version number in there (then restart Jenkins) and see if it processes this user more accurately.

SVN change username

I found a lot of examples on how to change the username for specific revisions and so on.
But what I need is this:
I did a checkout with the authentication credentials of a workmate and need to change it to my credentials for future commits.
I cannot just checkout with my credentials due to the many changes that have been done already...
Anyone familiar with this?
You can change the user with
Subversion 1.6 and earlier:
svn switch --relocate protocol://currentUser#server/path protocol://newUser#server/path
Subversion 1.7 and later:
svn relocate protocol://currentUser#server/path protocol://newUser#server/path
To find out what protocol://currentUser#server/path is, run
svn info
in your working copy.
The easiest way to do this is to simply use the --username option on your next checkout or commit. For example:
svn commit --username newUser
or
svn co --username newUser
It will then be cached and will be used as the default username for future commands.
See also:
In Subversion can I be a user other than my login name?
I’ve had the exact same problem and found the solution in Where does SVN client store user authentication data?:
cd to ~/.subversion/auth/.
Do fgrep -l <yourworkmatesusernameORtheserverurl> */*.
Delete the file found.
The next operation on the repository will ask you again for username/password information.
(For Windows, the steps are analogous; the auth directory is in %APPDATA%\Subversion\).
Note that this will only work for SVN access schemes where the user name is part of the server login so it’s no use for repositories accessed using file://.
The command, that can be executed:
svn up --username newUsername
Works perfectly ;)
P.S. Just a hint: "--username" option can be executed on any "svn" command, not just update.
Go to Tortoise SVN --> Settings --> Saved Data.
There is an option to clear Authentication Data, click on the clear button, and it will allow you to select which connection you wanted to clear userid/pwd for.
After you do this, any checkout or update activity, it will reprompt for the userid and password.
If your protocol is http and you are using Subversion 1.7, you can switch the user at anytime by simply using the global --username option on any command.
When Ingo's method didn't work for me, this was what I found that worked.
for Win10 you should remove this folder and close/open your IDE
C:\Users\User\AppData\Roaming\Subversion\auth
, also in my projects no ".subversion" folders, only ".svn"
Also, for those who happened to realize too late, that they committed with the wrong credentials, the solution (after the fact) is to change the svn author of that revision: see this question
Basically the syntax is:
svn propset --revprop -r (revision_number) svn:author (new username)
Based on Ingo Kegel's solution I created a "small" bash script to change the username in all subfolders. Remember to:
Change <NEW_USERNAME> to the new username.
Change <OLD_USERNAME> to the current username (if you currently have no username set, simply remove <OLD_USERNAME>#).
In the code below the svn command is only printed out (not executed). To have the svn command executed, simply remove the echo and whitespace in front of it (just above popd).
for d in */ ; \
do echo $d ; pushd $d ; \
url=$(svn info | grep "URL: svn") ; \
url=$(echo ${url#"URL: "}) ; \
newurl=$(echo $url | sed "s/svn+ssh:\/\/<OLD_USERNAME>#/svn+ssh:\/\/<NEW_USERNAME>#/") ; \
echo "Old url: "$url ; echo "New url: "$newurl ; \
echo svn relocate $url $newurl ; \
popd ; \
done
Hope you find it useful!
I believe you could create you own branch (using your own credential) from the same trunk as your workmate's branch, merge from your workmate's branch to your working copy and then merge from your branch. All future commit should be marked as coming from you.
You could ask your colleague to create a patch, which will collapse all the changes that have been made into a single file that you can apply to your own check out. This will update all of your files appropriately and then you can revert the changes on his side and check yours in.
Tortoise on windows specific:
I attempted the above solution to no available. In my use case, the credentials where stored in the windows Credential Manager under the Windows Credential section and TortoiseSVN refused to change them by running the --username command.
You can edit the credentials by expanding the url for your repo and clicking edit.

Problems running paster shell example.ini in Ubuntu while trying to install reddit

When I try to run paster shell example.ini, I run into:
connection failure: TLEngine(postgres://reddit/password#127.0.0.1/reddit)
followed by a laundry list of traceback.
At the end, I get:
FATAL: password authentication failed for user "reddit"
Would anyone be able to help me resolve this issue? Any help is much appreciated. Thanks!
The Reddit Setup Guide seems to be out of date or something. I had the exact same problem as you on two different machines.
Here's how I overcame it:
$ sudo su - postgresq
$ psql reddit
reddit=# CREATE USER reddit WITH PASSWORD 'password';
I looked in the example.ini file and reddit/password was the default username/password for the DB. At this point, if you re-run your command (paster shell example.ini), it should complete successfully.
Fair warning, there are more problems with this setup after you get past this point, but I haven't yet conquered those myself.
Best of luck, friend!