Passphraseless ssh works but not with Hadoop - linux

I have installed Hadoop on an Ubuntu machine. I set up passphraseless ssh. I can use the command "ssh localhost" and it gives me information without needing to enter a password. However when I go to Hadoop and type "sudo bin/start-all.sh" it asks me for my password (because I used sudo which is fine), but after I enter that, it will do a couple things and then ask me for the root password which I believe it's not suppose to do. I've searched for a couple days now and I only end up with answers for when "ssh localhost" doesn't work. I haven't found anything for my problem. Any help is very much appreciated.
UPDATE:
It seems that I need sudo passphraseless ssh which is not the same as just passphraseless ssh. However, I am still unable to find out how to make this happen.

I just came back to check and realized I didn't post the solution I found. When installing Hadoop and generating keys, avoid using SUDO where ever it is not absolutely necessary. If you use SUDO, it will attempt to use the root keys which are not the same as the ones generated not using SUDO. Hadoop will automatically use the current user's keys and they won't work, so it prompts for a password.

When I stop using
**sudo** ./start-dfs.sh
And used:
./start-dfs.sh
I solved the shh communication problem with the namenode

Related

Sudo apt-get install in terminal asking for password

I'm using the AI Platform notebook and I want to install cuda because the Tensorflow can't use GPU.
sudo apt-get install cuda-cudart-10-0
Then in the command line it's asking me for password.
(base) jupyter#cuda-10-1-20201008-115420:~/tutorials/stylegan2$ sudo apt-get install cuda-cudart-10-0
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for jupyter:
Sorry, try again.
I don't recall I gave it any password while setting it up. Is there a default password for it?
To answer the first question, our Notebooks provide TensorFlow and when you create it, you can select to install Nvidia Driver automatically. Probably this option was missed during instance creation.
With respect to the second question, from the output, seems to be that you are in Jupyter Terminal.
Jupyter Notebooks provides access to Instance OS which could be Debian 9/10 or we support Ubuntu now. Jupyter Terminal process is running as jupyter user. While you can still run process as root. I would suggest you that you login via SSH and run commands directly from there. If you create the Notebook via UI we now provide OS login feature which allows you to access instance via SSH with IAM permissions hence your Google Cloud user account. If you are not sure of any of this, please contact your IT admin.
What do you think sudo does? If this is your first time using a Linux system, know that prepending every command in Linux with sudo is same as typing cmd in the windows run box and then pressing shift+enter. sudo is a way to tell the OS that I need admin rights (or in Linux's case, root permissions). So, it is bound to ask you for the password.
The password it is asking for is your account password. Also, it is usually a good idea to set up the root password when in first use. To set it up, drop into the root prompt from your user account using sudo su. Then type in passwd to set up a new password for the root user. Log out, and restart the machine.
Do not forget that root account has the ultimate privileges, and unless absolutely necessary, it is always better to prepend the command with sudo instead of dropping into the root prompt.
PS: A hint: sudo <command> followed by the caller's password is same as su -c '<command>' followed by the root account's password
You also might want to take a look at fakeroot
Which linux distro are you on? Like Kali has default password as root or toor or kali depending on version

How to start anaconda-navigator with root Privileges ? (Linux)

After starting "anaconda-navigator" with a terminal, it ends up with dialogue box prompting that " it can't be run with root privileges.anaconda-navigator startup error as root.
For anaconda-3 run:
source ~/anaconda3/bin/activate root
anaconda-navigator
Hopefully this will solve everything.
I have exactly the same issue that you have and after trying the shocking solutions provided i ended up with more errors as you can find in some of my comments there.
How to Fix this:
The dialogue box as you and I see it, is a common dialogue in the Linux world, it has only one reason and that is your GUI is logged with a "normal user" but somehow you managed to install the anaconda with superuser(root).
so if possible, head to your login section and login with root user + with GUI activated(only saying this because there's a big Linux world out there)
if this didn't help, re-install it but be careful when uninstalling it as python can mess a lot of things up(its an OS bomb actually).
How to prevent this:
1- do not allow Anaconda installation to use any superuser areas like /root
2- try to install it with normal user and with sudo command
Good luck (the thing we all need with python installers)
The installation process should be done with the regular user but no root. In my case, the problem appears when I installed with superuser session. I follow these instructions, installing just with my username (without sudo privileges) and the problem was solved.
In /home/user/anaconda3/lib/python3.7/site-packages/anaconda_navigator/app/start.py:
if (MAC or LINUX) and os.environ.get('SUDO_UID', None) is not None:

Is there a way to 'store' Sudo temporarily

I'm quite new to Linux. I remember using a tutorial were you were able to declare your sudo (+password) at the start and then use terminal without having to do sudo or import your password again.
I.e.
Sudo yum-get update -> yum-get update.
Sorry if this is a very obvious question, I honestly don't remember where the tutorial was from, and how to do it again.
ps - if it helps, I'm on a RedHat Distro, but go between Debian and RedHat.
You can use su. This way you are changing the ownership of the session to root (by default, you can also change to any other user on the system) and therefore you will be able to avoid the sudo.
Here you can find some more information on the command.
You may use
sudo -i
It acquires the root user's environment and kind of simulates a login into the root account

How to log in into the linux terminal as ROOT user using ruby script

I want to run a script on remote server using SSH.
I have write all the code which runs properly using system command.
To run my code on remote server I need some packages which I need to install on remote server.
To do so I need login into remote terminal as a ROOT user. When I try to do using Ruby script so I get something like following
[not_root_user#remote_server]$ su
Password:
I need some command using which I can able to login into the remote server something like following
[not_root_user#remote_server]$ su -p ******
[root#remote_server]#
Is there any linux command which accepts the password in it?
So you want your script to act as root?
It's not really recommended, but you can use expect: http://en.wikipedia.org/wiki/Expect
The wiki there has a walkthrough for a basic automated telnet session that you could adapt to your needs.
However, you're going to have your root password in plain text, which could be a security issue. If you go that route, I'd definitely obliterate all copies of that script from the universe once this package is installed.
But if you're allowing direct root logins, you've already got a bit of a security problem. Sudo works out-of-the-box on every modern linux distro I've used, I'd stick with that, if possible.
Another option which is equally tasteless would be to set up root-to-root login without a password via ssh.
Sudo would be my first option to getting around this. Although not the best option.
You can also use Key authentication with SSH, and if password authentication is turned off there is no need to enter a password.

"bash:psql command not found" error

I have installed postgressql 8.4-91 version in my Linux OS.
On going to the directory where its installed I am able to locate psql in the directory.
I am having 2 issues.
on typing ./psql ,it asks for a password and doesn't accept any password.
On typibf psql i am getting " command not found"
The second one is easy. Most secure Linux system don't include . (the current directory) in the path (i.e., $PATH).
This avoids the attack vector of providing an ls script in your directory that will run if someone is foolish enough to have . before the real location of ls in their path.
If you really want to be able to run it without the dot, the safest option is to set up an alias like:
alias pg='./psql'
and then use pg to run it. I would advise against putting . in your $PATH variable, at least on a shared machine. If you're the only one able to muck about on your machine, then you could probably do it safely.
The first you can probably get around by editing the pg_hba.conf file to get rid of authentication, using alter user (or add user) to set up a password then turn authentication back on.
Or you could just run without authentication in your development environment, as so many of us do :-)

Resources