Provide Hadoop full access to Admin from Root in CentOS - linux

I have installed Hadoop-2.8.0 being root in below directory.
/root/hadoop-2.8.0
I have a user named "KrishnaMahi". He is admin. He is in below directory.
/home/krishnamahi
I want to provide full access of Hadoop to admin. How shall I provide full access to admin without giving root password? I am using CentOS 7. Please help me with a solution.

Under the root user execute the following command
chown -R krishnamahi:krishnamahi /root/hadoop-2.8.0
and then execute the next command to be the root user without password
visudo
Insert this code at the last line
krishnamahi ALL=(ALL) NOPASSWD:ALL
save changes & exit

Execute the following once command
sudo chown -R krishnamahi:krishnamahi /root/hadoop-2.8.0
Then the user have full access to the hadoop directory.

Related

I want to create a restricted user with custom home directory, but after doing so I am unable to import a python file

I want to add a user who can only execute a few commands and nothing else, at the same time I have created a shared folder (group) where my files are present. I want the user to only execute the files in the shared folder and restrict him from reading it or opening it and so on.
These are the set of commands I am using to create a restricted user. After these commands I am changing the PATH in the .bash_profile file to $HOME/commands directory.
This is how it looked when I login from the user account
I have added the user to the group using this command: sudo usermod -a -G bbc testuser
Now when I change the home directory to the shared file group using usermod --home /path/to/new/directory testuser, it shows like this when I login through the new user
This has no restriction on the commands being used, although ls and cd commands wont run other commands like nano to see the file content works. I want to restrict this as well
So after this If I try to import a python file in the new user it says 'module not found', this same command works in the ec2-user or root user.
Please help me solve this issue.
Thank you

create ubuntu server user with only read/write permissions for home directory

I would like to create some users on my ubuntu server. I only want to let the users have read/write access to their home directories, and not be able to read or write to any other user's home directory. Does anyone have a suggestion how to do this? Like is there a way to create a group that has these permissions and then add all the users to the group? Or do I need to create each user, and just grant them only read/write permission on their home directory? I'm new to ubuntu server and when I create a new user, it seems to have all the same permissions that my account does.
First, this question is better suited for Ask Ubuntu, the stack exchange site specifically for ubuntu questions.
To answer your question, I'd recommend reading the ubuntu article on user management, everything you need to know is there. Here are the relevant sections:
To add or delete a personalized group, use the following syntax,
respectively:
sudo addgroup groupname
sudo delgroup groupname
To add a user to a group, use the following syntax:
sudo adduser username groupname
When a new user is created, the adduser utility creates a brand new
home directory named /home/username. The default profile is modeled
after the contents found in the directory of /etc/skel, which includes
all profile basics.
If your server will be home to multiple users, you should pay close
attention to the user home directory permissions to ensure
confidentiality. By default, user home directories in Ubuntu are
created with world read/execute permissions. This means that all users
can browse and access the contents of other users home directories.
This may not be suitable for your environment.
To verify your current user home directory permissions, use the
following syntax:
ls -ld /home/username
The following output shows that the directory /home/username has
world-readable permissions:
drwxr-xr-x 2 username username 4096 2007-10-02 20:03 username
You can remove the world readable-permissions using the following
syntax:
sudo chmod 0750 /home/username
A much more efficient approach to the matter would be to modify the
adduser global default permissions when creating user home folders.
Simply edit the file /etc/adduser.conf and modify the DIR_MODE
variable to something appropriate, so that all new home directories
will receive the correct permissions.
DIR_MODE=0750
After correcting the directory permissions using any of the previously
mentioned techniques, verify the results using the following syntax:
ls -ld /home/username
The results below show that world-readable permissions have been
removed:
drwxr-x--- 2 username username 4096 2007-10-02 20:03 username

cannot log in to google cloud master node root

I am very new to this stuff and do not have much experience with linux - any help would be highly appreciated.
I am unable to login as root - I seem to be getting the following error when I sudo su root:
sudo: effective uid is not 0, is sudo installed setuid root?
It seems the permissions on the sudo executable has somehow been changed to full permissions, ie. 777
How can I change the permissions on this as we do not know the root password?
Is there some sort of default root password or any other way to change these permissions?

Apache & SFTP permissions on AWS EC2 Linux hosting

Using SSH I've granted access to my SFTP clients user "ec2-user" with the following command:
sudo chown -R ec2-user /var/www/html
However I also need to grant access to Apache which I can do with the following command:
sudo chown -R apache:apache /var/www/html
I assumed this would grant access to both, but this is not the case. How can I apply the command to both ec2-user & Apache at the same time?
When you have executed chown commands, you did next: at first you've changed the owner of /var/www/html to ec2-user, and with next command you've changed the owner and owner group to apache. You can set only one pair of owner:owner-group to file or directory or whatever.
You have at least two ways to solve your task:
usermod -a -G apache ec2-user - this will add user ec2-user to apache group, after that, make sure, that permissions allows apache group members to manipulate files and directories as you need.
Create a subdirectory in /var/www/html with owner set to ec2-user and group set to main apache group and make sure that Apache could access it. You can configure it as a VirtualHost to separate it from original DocumentRoot.
Also, you have to set ec2-user home directory to /var/www/html, because even if it's has rights to access /var/www/html, it isn't necessary that it can access /var or /var/www.
These instructions helped me to get this up and running very easily:
https://devanswers.co/configure-sftp-web-server-document-root/
Here's a cached version:
https://web.archive.org/web/20201203122712/https://devanswers.co/configure-sftp-web-server-document-root/
The idea here is to create a group like sftp_users and then set permissions to that group, adding the user to that group (the link above details all configurations and setup very well)

Chmod in Shell Script does not work

i am running a small server using Ubuntu 12.04. I am logged in as a non-root user via SSH public key authentication. This server runs apache which is supposed to run a symfony2 website.
I want to write a shell script that ensures that every file and directory in my symfony2 app has the right owner and the right access rights. The script I use is this:
#!/bin/bash
chown -R www-data:www-data portal
chmod -R 755 portal
php portal/bin/console cache:clear --env=dev
php portal/bin/console cache:clear --env=prod
The script has been granted the exec right via chmod +x setup (setup is the name of the script)
I try to execute it as an root via ./setup.
There are no error messages displayed. But after running it the chown and chmod does not seem to work. the owner is still the same (root:root)
If I execute these commands manually in the console they work.
Why is this? What can I do to solve the problem?
Kind regards
Thomas

Resources