Dokku - /home/dokku/.sshcommand: No such file or directory - dokku

I've installed Dokku on a VPS running CentOS7. When I 'git push dokku master' I'm getting...
git remote set-url dokku dokku#mydomain.com:trial
git push dokku master
cat: /home/dokku/.sshcommand: No such file or directory
fatal: ''trial'' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
When I try and ssh in I also get the same error...
ssh dokku#mydomain.com
cat: /home/dokku/.sshcommand: No such file or directory
Connection to mydomain.com closed.
cat /var/log/secure ...
Nov 7 10:06:29 Callisto sshd[19912]: Accepted publickey for dokku from xxx.xxx.xxx.xxx port 50002 ssh2: RSA SHA256:Y0ueDcZEJWQd9H3FsetReYTDPwJPob6zm9p4Dpt4fOE
Nov 7 10:06:29 Callisto sshd[19912]: pam_unix(sshd:session): session opened for user dokku by (uid=0)
Nov 7 10:06:29 Callisto sshd[19914]: Received disconnect from xxx.xxx.xxx.xxx port 50002:11: disconnected by user
Nov 7 10:06:29 Callisto sshd[19914]: Disconnected from xxx.xxx.xxx.xxx port 50002
Nov 7 10:06:29 Callisto sshd[19912]: pam_unix(sshd:session): session closed for user dokku
Prior to pushing I'm creating the app on the server...
dokku apps:create trial
To add my public ssh key to server I used dokku ssh-keys:add dokku id_rsa.pub
Looking at another answer here it seems that I am in fact missing .sshcommand in /home/dokku/ . Any ideas on how to fix this or what could have gone wrong? This has been driving me crazy the last couple of days.

You must have deleted it at some point. Run the following commands to set everything up again:
echo '/usr/bin/dokku' > /home/dokku/.sshcommand
chmod 0644 /home/dokku/.sshcommand
chown dokku:root /home/dokku/.sshcommand

Related

Start service remote by http request

I hava a systemd service "myservice" running as user www-data. I want to start/stop/restart this service by a http request. The problem is, that I get an error because of missing authentication:
Failed to restart myservice.service: Interactive authentication required.
See system logs and 'systemctl status myservice.service' for details.
First I request a php script, calling restartService.sh:
$exec_command = "../restartService.sh";
restartService.sh is only one command:
systemctl restart myservice.service
Owner and group of restartService.sh are ww-data:
-rwxr-xr-x 1 www-data www-data 41 Aug 24 12:42 restartService.sh
Any suggestions for solutions?
You can use sudo configuration to give the www-data user permission to run systemctl restart yourservice without giving it permission to run any other commands as root.

Serial port permission denied for non-root user with dialout group privileges even after reboot Ubuntu 18.04

I write systemd services that launch with root privileges and de-privilege themselves to a system account (called mxdaemon). These services require access to the physical serial port (/dev/ttyS0) on the PC. Serial port ls -l:
Serial port: crw-rw---- 1 root dialout 4, 64 Jun 13 22:00 /dev/ttyS0
When run as root, the service has no problem communicating via the serial port.
When the service is configured to de-privilege to mxdaemon, I get a permission denied error when attempting to access /dev/ttyS0.
mxdaemon is a member of both the dialout & tty groups:
mxdaemon : mxdaemon dialout tty
Even after logging out and/or rebooting the PC, I still get permission denied for ANY user besides root.
Hours of scouring the Internet suggest that everything is configured correctly.
Any help would be appreciated!
-Rob
#sawdust: Thanks for the reply! Here's the info...
/etc/group : dialout:x:20:mxdaemon,mxadmin
/etc/gshadow : dialout:*::mxdaemon,mxadmin
Thanks for the pointer #sawdust - here's what the command yielded...
ps -o user= -o group= -p 15150
mxdaemon root
So, the user is mxdaemon but it shows being part of the root group?

FileZilla: able to connect via SFTP, but failed to list directories

I used FileZilla to connect to one of my Linux servers via the SFTP protocol, but got below error stack trace.
Status: Connecting to <server_ip>...
Response: fzSftp started, protocol_version=5
Command: keyfile "C:\ruifeng_ibm.ppk"
Command: open "root#<server_ip>" 22
Status: Connected to <server_ip>
Error: Connection timed out after 20 seconds of inactivity
Error: Could not connect to server
On the server when I ran lsof -i, I was able to see the established sshd connection.
sshd 12333 root 3u IPv4 109406 0t0 TCP <server_hostname>:ssh-><workstation_ip>:54315 (ESTABLISHED)
How could the directories not be listed when the connection is successful? No idea how to debug either.
Turned out to be a silly problem.
I put below welcome message in the .bashrc file.
echo -e "\n\nHello Ruifeng...Welcome to the Arena! \n#>>------>---->>"
Either it contained some illegal characters FileZilla does not honor, or it's completely not supported by FileZilla. Too lazy to further dig in. After removing this message, the connection worked and the directories got listed.

SFTP not working

I have a CentOS server where I have installed the vsftpd service, however I am getting the error
bash: sftp: command not found
Even the which sftp command can't find this service.
Detailed steps below :
As root:
yum install vsftpd
Total download size: 139 k
Is this ok [y/N]: **y**
Configure:
vi /etc/vsftpd/vsftpd.conf
Change anonymous_enable=YES to anonymous_enable=NO
Add userlist_deny=NO after userlist_enable
Add allowed users:
vi /etc/vsftpd/user_list
Replace contents with:
vsftpd userlist
userlist_deny=NO so only allow users in this file
user
Turn on Vsftpd service
chkconfig vsftpd on
Start the service
service vsftpd start
Can someone help figuring out what I'm doing wrong ?
sftp binary is provided by the openssh-clients package. Install that before:
yum install openssh-clients
then you can run sftp.
Assuming the vsftpd daemon is now running and can get through any firewall you have, you need to use an ftp client to connect to the server.
yum install ftp
ftp x.x.x.x <-- IP address of server
That will show that it is working. Remotely you will need a client such as Filezilla.

Go from AWS root to ec2-user

Using unix, I'm able to ssh successfully into my instance using the following:
ssh -i ~/.ssh/seis_v3.pem root#52.5.233.876
However, when I try to login as ec2-user instead of root, I get denied. Is there a way once in root#52.5.233.876 to change directory or permissions to get onto ec2-user? Thank you.
ami-728ace1a corresponds to the this AMI : suse-sles-11-sp3-sapcal-v20150127-hvm-mag-x86_64. It's an image for SUSE Linux Enterprise Server 11. I just launched an instance using this AMI and when I tried to ssh in as root:
$ ssh -i id_rsa root#54.158.122.xxx
Please login as the user "ec2-user" rather than the user "root".
So I tried to log in as the ec2-user:
$ ssh -i id_rsa ec2-user#54.158.122.xxx
Last login: Mon Apr 13 01:35:47 2015 from xxx.xxx.xxx.xxx
SUSE Linux Enterprise Server 11 SP3 x86_64 (64-bit)
You mentioned being able to successfully log in as root. Do you get the message that I got above? If not then are you sure you provided the correct AMI ID for this instance? Did you make any changes to the root account and/or any other accounts on this system after launching it? Do you see an ec2-user listed in /etc/passwd?

Resources