proftpd configuration issue - ftp

I have installed proftpd file server using apt-get
But after adding User as shown below:
sudo useradd myproftpduser
sudo passwd myproftpduser
sudo usermod -m -d /var/www/ myproftpduser
and after restarting proftpd service I am not able to login with the new user.
I am able to login only with proftpd user.
Not sure where I am making mistake

The right way to create user in proftpd
sudo useradd myproftpduser -d /var/www/myproftpduser -s /bin/false

Related

i am creating script that is going to login into remote server and and then do sudo to other user

i am creating script that is going to login into remote server and and then do sudo to other user. With that sudo user i want to run command with that user. Request to help!!!
ssh ${user}#${line} -qtt -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null "sudo su - ${dict['sid_'$n]}adm; ls -ltr"
cd /usr/sap/${dict['sid_'$n]}
ls -tlr
sudo su - sidadm
then run the command
Try this:
ssh <user>#<host> -qtt <other_ssh_options> "sudo su - <user_at_host> -c <command>"

How can I use a bash script to run postgres when launching AWS EC2 instance?

I'm testing some set ups for EC2 to run geoserver. When launching the EC2 instance I have a bash script to speed things up. However, when it gets to the point of creating a postgres db it fails. Below is an excerpt of the script and it appears to fail after the second line:
chown postgres /usr/local/pgsql/data
sudo su postgres
initdb -D /usr/local/pgsql/data
postgres -D /usr/local/pgsql/data &
exit
yum install gcc make gcc-c++ libtool libxml2-devel -y
# ..... etc etc
I've SSHed into an instance an run the above code manually, then made an AMI from that instance which works. I'd still like to know how to have a bash script for Amazon linux that can also start postgres.
You can't put sudo su postgres in a script to have the subsequent lines be executed by the postgres user. You need to write like:
chown postgres /usr/local/pgsql/data
sudo -u postgres initdb -D /usr/local/pgsql/data
sudo -u postgres -D /usr/local/pgsql/data &
yum install ...

user is not in the sudoers file. This incident will be reported in osx mac

hi i am using mac osx i tried to login sudo without password i followed this tutorial and edited this code in sudoers file
chmod +w /etc/sudoers
USERNAME ALL=(ALL) NOPASSWD: ALL
chmod -w /etc/sudoers
but now when i am trying to run any script with sudo command or trying to sudo -i its giving this error
user is not in the sudoers file. This incident will be reported.
this only user am using means its root user and i tried this also
MacBook-Air:~ exepaul$ sudo chmod +w /etc/sudoers Password: exepaul is not in the sudoers file. This incident will be reported.
so please help me ;(
for my instance , i just
su root
then enter self-define user password, then it switch to root!...
then i change root password to new one

Run sudo as specific user without password

I used the following command in my script
sudo su - user -c bash <<EOF
cp /home/test.txt /opt/
EOF
If I use the sudo su - user on terminal, Unix don't ask me the Password but if I try to run the script the terminal ask me the Password and if I delete the EOF part the rest of code run when I quit the session.
I want to run the command in user mode sudo but the terminal don't Need ask me the Password.
If I use
sudo su - user <<EOF
code
EOF
I have an error in .bash_profile: too many argument
I want to run the command in user mode sudo but the terminal don't
Need ask me the Password.
The scenario you are experiencing is caused by the users cached credentials for sudo, which allow sudo to maintain a session and any further sudo command will not prompt for passwords.
Check this:
Open a new terminal and run sudo whatever, then close it and open another new terminal and run sudo whatever, you will see that sudo asks for password every time...
If you still need to do that, then you have the following options:
Prevent sudo to ask for password permanently:
run sudo visudo and look for the line root ALL=(ALL) ALL, then add a line
username ALL=(ALL) NOPASSWD: ALL
then save and exit.
Note: This is a security risk
Or Prevent sudo to ask for password permanently only for specific script:
run sudo visudo and look for the line root ALL=(ALL) ALL, then add a line
username ALL=NOPASSWD: path_to_the_script
then save and exit
Provide password inside the script, by running your sudo command like this:
sudo -S <<< "password" command
Note: This is a security risk too.
I guess you need to execute your command as a different user. This might be your answer: Run a shell script as another user that has no password
sudo -H -u otheruser bash -c 'echo "I am $USER, with uid $UID"'
It is a quote from the link. Probably the following is better for you:
sudo -H -u otheruser bash <<EOF
cp /home/test.txt /opt/
EOF
UPDATE: You may wish to create a specific sudo rule to run a specific command without password (inside /etc/sudoers file -remember to use visudo to edit it-):
otheruser ALL=NOPASSWD: /full/path/to/your_command.sh
(of course you need root access to edit sudoers, I hope you can do it).
And create the script called your_command.sh that contains your logic. You'll then be allowed to run it without password:
sudo -H -u otheruser your_command.sh
I know, it's not a "single line command" but it is safe as it allows only one specific command without password. And it doesn't require a password, of course!
Then don't use sudo, then it won't ask for password, but you will to be have logged in as root!

sudo password vs su password

My password for sudo commands works on my Mac, but it doesn't work for su? How can I reset (or find) my su password?
I ask because I need to make my /data/db directory readable/writable for installing MongoDB and my sudo command isn't doing the trick. I was told to use su chmod 777 /data/db but the password is different from my sudo password.
sudo -s to get root, then passwd to change the root password. There might not be need to change the root password in your case; you can paste that command in after obtaining root via sudo -s.

Resources