Glassfish: How to do asadmin commands without password? - linux

every time I enter a CLI-command for glassfish like this asadmin start-instance i1 I am prompted to enter the admin-username and admin-password.
How can I disable the need for entering these credentials?
I plan to write scripts for running commands like this and I think it's not possible to enter the credentials in a bash script.
Thanks

The password file option is perhaps to verbose.
Simply do the following:
asadmin start-domain mydomain
asadmin login
Put in the admin user name and the admin password.
In your user home directory a file will get created
".asadminpass] successfully.
Make sure that this file remains protected.
Information stored in this file will be used by
asadmin commands to manage the associated domain.
Command login executed successfully."

You can set the password from a file instead of entering the password at the command line.
The --passwordfile option takes the file containing the passwords:
AS_ADMIN_PASSWORD=value
AS_ADMIN_ADMINPASSWORD=value
AS_ADMIN_USERPASSWORD=value
AS_ADMIN_MASTERPASSWORD=value

Related

Password for default system user created in JupyterHub

I am running Jupyter-Hub with default authenticator and default spawner. Logged in to Jupyter-Hub with system username (admin). I added a new user called user1 in JupyterHub web console. The user got created in both the machine and Jupyter-Hub server as I added c.Authenticator.create_system_users = True in the config file. When I checked the machine users, user1 is added because of the above property added in the config file. Can anyone tell me what is the password for user1 as there is no password option to be given in Jupyter-Hub? I tried with empty, user1, 12345 and 123456.
I was trying to switch user by using su command. i.e su user1. It asks for the password.
when i cat /etc/shadow this is what i got,
user1:*:121212:0:99999:7:::
As stated in the docs (https://github.com/jupyterhub/jupyterhub/blob/master/docs/source/getting-started/authenticators-users-basics.md#use-localauthenticator-to-create-system-users), this option essentially acts like the adduser command. Even on command line this just creates the user, you cannot login to this user before you set a password via the passwd command.
Also, like the docs said, it is not recommended when JupyterHub users are directly mapped onto UNIX users, probably in part because of this password limitation...

Why does jenkins need sudo password when ssh account doesn't?

My linux user account has the rights to run a particular sudo command without a password prompt. I am trying to implements jenkins to run this command. It is set up to ssh as my user account on the box with the Publish Over SSH plugin.
When I am in the box $USER shows the correct user, but when I try to run "sudo {command}" (which runs without password when I am using that box normally with my user) it requires password. What is causing this behavior?
Because it is configured to do so. There is file /etc/sudoers specifying these rules and there is respective manual page describing how does this file and the roles work. It is probably a good start to read.

FTP From Local Desktop to Server As Sudo User

I have a file on my desktop that I need to FTP to a server. As I've been navigating this server, I need to login with initial credentials to access the box and then needed to run sudo -u [username] ksh to access the folder I need. (No password)
In Filezilla however, I only enter credentials once and therefore, don't have the option to sudo as the user and get permissions to the folder.
Am I going about this process wrong and if so, what's the usual way to do this?
There is no way to switch user on the ftp protocol. You need to know the correct credentials in the first place.
The closest you could come would be to ftp the files to a directory you do have access to, log in with a shell, and then move the files using shell commands after switching user.

Updating WordPress with SSH (Cent OS)

I am new to SSH and Linux and I hope someone can help. I am working on a site with a dedicated server (VPS) and I am also working with WordPress. I used SSH to log into the site's files with Cyberduck (I've also used FileZilla successfully) and install WordPress on the server.
The problem I'm having now is that I can't edit or add any plugins or files on WordPress because WordPress doesn't have access to the site's FTP which is standard. It asks for credentials and when I attempt to enter them into the WordPress dashboard, it doesn't work. There is an option for FTP and there is an option for FTPS (SSL). I know these are different than SSH but I tried the SSH credentials anyway and obviously they didn't work.
I then logged into the SSH through Mac Terminal and did the instructions here:
1. Login as root through SSH.
2. Next add the user account you want using the 'useradd' command
useradd <username>
3. Now create a special group for that user.
groupadd <groupname>
4. Now to add the user to the group
gpasswd -a <username> <groupname>
5. Change the group ownership of the special directory to that group.
chgrp -R groupname
/path/to/your/web/directory
6. Enable write permissions
chmod -R g+rw
/path/to/your/web/directory
And it worked. I was able to add a new user (and I could confirm this by looking at the /etc/passwd file). I then logged out and tried to log in with Cyberduck using the new credentials and setting it to FTP (instead of SSH) and it didn't work. It did however work to log in with SSH with the new user credentials. So it seems I can successfully add a new SSH user but not a new FTP user.
I need the user to be FTP so I can hook WordPress up and begin editing. How do I specific the user to be FTP as opposed to SSH? Thanks for any help!
I've found an answer to my question and figured I'd document here for anyone else who runs across this issue. It's surprisingly easy.
Just go to this link and download the plug-in:
http://wordpress.org/plugins/ssh-sftp-updater-support/
You obviously have to upload this straight into your WordPress directory in the SFTP (/wp-content/plugins) in order for it to work correctly since it won't work from within the WordPress dashboard.
Once those files are there, when WordPress prompts you to login to your 'FTP' it will have an option for SSH which you can select and log-in. Voila!

How to login ftp with user name and password from AIX 6.1?

I want to develop a command line to login the ftp server with username & password. The script would be run on AIX 6.1, but now I was stuck.
I have searched on google and got some solutions, but no one works. See commands I have tried below:
ftp ftp://username:password#server
ftp username:password#server
ftp server /user:username /password:password
ftp USER username PASS password
Could you please tell me the correct command?
Thanks.
Create a text file in your home directory named .netrc containing:
machine myserver.example.com login myusername password mypassword
However it would be more secure to set up ssl and use scp. There's little reason to use an insecure protocol like ftp.

Resources