Does anyone know why this command,
ssh -v user#address "exec ssh-agent bash"
...would hang on this output?
debug1: Sending command: exec ssh-agent bash
I'm trying to automatically setup a set of remote machines so they can SSH into each other without passwords. Have already scp'd over the relevant private key file. Need to run ssh-add on each instance. But first, I need to start the ssh-agent. But the command above hangs. Starting the agent manually on each instance is not really an option.
Running "ps ux" on the remote machine manually confirms that the ssh-agent is running:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
ubuntu 746 0.0 0.2 8844 1380 ? S 02:45 0:00 sshd: ubuntu#notty
ubuntu 747 0.0 0.1 4532 1096 ? Ss 02:45 0:00 bash
ubuntu 748 0.0 0.0 3360 204 ? Ss 02:45 0:00 ssh-agent bash
ubuntu 779 0.0 0.2 8844 1376 ? S 02:51 0:00 sshd: ubuntu#pts/0
ubuntu 781 5.3 0.8 8260 5244 pts/0 Ss 02:51 0:00 -bash
ubuntu 813 0.0 0.1 4284 1076 pts/0 R+ 02:52 0:00 ps ux
Any help is appreciated.
What you see is the expected behavior. SSH is waiting for bash to finish execution. If you omit the "bash" as the argument to ssh-agent, then ssh-agent goes in the background like you expect it to.
So, perhaps you meant to run:
ssh -v user#address "ssh-agent"
looking at pstree output shows more clearly what is happening.
|-+= 09556 root /usr/libexec/launchproxy /usr/sbin/sshd -i
| \-+= 09557 root /usr/sbin/sshd -i
| \-+- 09560 root /usr/sbin/sshd -i
| \-+= 09561 root bash
| \--= 09562 root ssh-agent bash
Related
I have an Ubunto 18.04 LTS running with apache2 and various PHP versions (5.6 up to 8.0).
Apache is configured to run as the same user as my FTP user (let's call him 'test').
ps aux | grep apache2
says this user name for the processes.
Problem: When I run my website on it, which creates a file, then the file is created as user 'www-data', which only works if I give 777 permission to the folder, as the folder has the user 'test' as it's owner.
Question: How can I make apache write files as the user used for the process it runs with?
Output of ps aux | grep apache2:
test#webserver:/var/www$ ps aux | grep apache2
root 11101 0.0 0.9 501228 27696 ? Ss 14:42 0:00 /usr/sbin/apache2 -k start
test 11103 0.0 0.2 159948 6660 ? S 14:42 0:00 /usr/sbin/apache2 -k start
test 11106 0.0 0.5 503824 16896 ? S 14:42 0:00 /usr/sbin/apache2 -k start
test 11107 0.0 0.5 503556 15348 ? S 14:42 0:00 /usr/sbin/apache2 -k start
test 11109 0.0 0.5 503556 15348 ? S 14:42 0:00 /usr/sbin/apache2 -k start
test 11111 0.0 0.5 503556 15348 ? S 14:42 0:00 /usr/sbin/apache2 -k start
test 11112 0.0 0.5 503556 15348 ? S 14:42 0:00 /usr/sbin/apache2 -k start
test 11114 0.0 0.5 503556 15348 ? S 14:42 0:00 /usr/sbin/apache2 -k start
test 11135 0.0 0.0 13144 1024 pts/0 S+ 14:45 0:00 grep --color=auto apache2
I'm trying to initialize Yii2 apps and after i run the command php init and all files generated by yii i try to view from n=my browser but keep getting error, i have search on google and on stackflow for possible solution with no luck, what i've tried so far, i run the command chmod 0777 web/assets i also do ps -ef | grep apache | grep -v grep and i got the below
apache 4074 4073 0 20:38 ? 00:00:01 /usr/sbin/httpd -DFOREGROUND
apache 4075 4073 0 20:38 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 4076 4073 0 20:38 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 4077 4073 0 20:38 ? 00:00:01 /usr/sbin/httpd -DFOREGROUND
apache 4078 4073 0 20:38 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 4083 4073 0 20:38 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
the i proceed doing sudo chgrp apache ./assets and then sudo chmod g+w ./assets/ it all not working i guess this is a kind of server problem, any help on this will be appreciated thanks
maybe the directory owner has conflict with your php user,
run this command to get your apache user:
ps -ef | grep apache | grep -v grep
then you can see {apache_user}, run below command in your frontend/web directory:
sudo chgrp {apache_user} ./assets
sudo chmod g+w ./assets/
but if it doesn't work, give me about your operation system information
On macOS Sierra, I installed Apache using Homebrew:
$ brew install httpd24
This has caused some weird Apache issues. It seems that the default installation of Apache on macOS Sierra was still active in some way. I now want to completely uninstall httpd24 but am still seeing it in my processes. Here's what I did:
$ brew unlink httpd24
$ brew uninstall httpd24
$ rm -rf /usr/local/etc/apache2/
Running $ ps aux|grep httpd reveals:
blt 51473 0.0 0.0 2613988 844 ?? S 10:48PM 0:00.00 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt 51447 0.0 0.0 2613988 892 ?? S 10:47PM 0:00.00 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt 51396 0.0 0.0 2613988 856 ?? S 10:47PM 0:00.00 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt 51345 0.0 0.0 2613988 844 ?? S 10:47PM 0:00.00 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt 51285 0.0 0.0 2613988 876 ?? S 10:45PM 0:00.00 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt 51048 0.0 0.0 2615200 868 ?? S 10:34PM 0:00.00 /usr/sbin/httpd -T
blt 51047 0.0 0.0 2615200 840 ?? S 10:34PM 0:00.00 /usr/sbin/httpd -T
blt 51046 0.0 0.1 2628716 20104 ?? S 10:34PM 0:00.06 /usr/sbin/httpd -T
blt 51045 0.0 0.1 2628716 20084 ?? S 10:34PM 0:00.05 /usr/sbin/httpd -T
blt 51044 0.0 0.1 2628716 20148 ?? S 10:34PM 0:00.04 /usr/sbin/httpd -T
blt 51043 0.0 0.1 2628716 20236 ?? S 10:34PM 0:00.05 /usr/sbin/httpd -T
blt 51041 0.0 0.1 2628716 20668 ?? S 10:34PM 0:00.07 /usr/sbin/httpd -T
blt 51040 0.0 0.4 2644668 59852 ?? S 10:34PM 0:01.05 /usr/sbin/httpd -T
root 47136 0.0 0.1 2615456 18872 ?? Ss 5:34PM 0:00.67 /usr/sbin/httpd -T
root 43442 0.0 0.0 2614244 7172 ?? Ss 4:14PM 0:00.83 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt 52451 0.0 0.0 2423384 256 s003 R+ 11:06PM 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn httpd
The processes with the path /usr/sbin/httpd are the default Apache installation. The ones with the path /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd is the Homebrew installation. This shouldn't even be possible. The directory /usr/local/Cellar/httpd24 doesn't even exist. I have tried manually killing those processes but they eventually come back. I have tried restarting my computer. I have restarted Apache countless times. I have confirmed that the Apache I am interacting with on the command line using $ apachectl is the default installation. I don't know what else to do. Thank you for any help.
I can't remember what exactly I did to resolve this, but I've pieced together a bash alias that might be useful to other people who are using Homebrew PHP but the default Mac OS Apache. It will stop Apache, kill any Homebrew Apache (httpd24) processes, unlink and uninstall Homebrew Apache and restart the remaining default Apache installation. Occasionally I have to use this after installing a new PHP version using Homebrew. See this issue for more information: https://github.com/Homebrew/homebrew-php/issues/3601
alias fix_apache='sudo apachectl stop; sudo pkill -f /usr/local/Cellar/httpd24; sudo pkill -f /usr/sbin/httpd; sudo pkill -f /usr/local/opt/httpd24; brew unlink httpd24; brew uninstall --ignore-dependencies --force httpd24; sudo apachectl start;'
I had the same problem and have followed #maskedjellybean answer, by upgrading the script for httpd, according to #pilot comment (i am using currently version 2.4.48).
Code follows:
alias fix_apache='sudo apachectl stop; sudo pkill -f /usr/local/Cellar/httpd; sudo pkill -f /usr/sbin/httpd; sudo pkill -f /usr/local/opt/httpd; brew unlink httpd; brew uninstall --ignore-dependencies --force httpd; sudo apachectl start;'
It all worked perfectly.
Monit can not start redis-server properly.
Running Redis through init.d works correctly:
$ sudo su
$ /etc/init.d/redis_6379 start
$ #=> Starting Redis server...
$ ps aux | grep redis
$ #=> root 8980 0.0 0.0 42128 1964 ? Ssl 04:56 0:00 /etc/redis/src/redis-server *:6379
$ /etc/init.d/redis_6379 stop
$ #=> Stopping ...
$ #=> Redis stopped
$ #=> (ps aux| grep redis) There's no redis process.
Running Redis through Monit does not work correctly:
(I killed the Redis process and rm /var/run/redis_6379.pid)
$ sudo su
$ monit start redis
$ ps aux | grep redis
$ #=> root 9082 0.0 0.0 35076 1972 ? Ssl 05:08 0:00 /etc/redis/src/redis-server *:6379
monit.log:
[MSK Jan 6 05:08:14] info : 'redis' start on user request
[MSK Jan 6 05:08:14] info : monit daemon at 3947 awakened
[MSK Jan 6 05:08:14] info : Awakened by User defined signal 1
[MSK Jan 6 05:08:14] info : 'redis' start: /etc/init.d/redis_6379
[MSK Jan 6 05:08:44] error : 'redis' failed to start
[MSK Jan 6 05:08:44] info : 'redis' start action done
Stopping Redis through Monit does not works correclty also:
$ ps aux | grep redis
$ #=> root 9018 0.0 0.0 35076 1968 ? Ssl 05:02 0:00 /etc/redis/src/redis-server *:6379
$ monit stop redis
$ ps aux | grep redis
$ #=> root 9082 0.0 0.0 35076 1972 ? Ssl 05:08 0:00 /etc/redis/src/redis-server *:6379
monit.log
[MSK Jan 6 05:10:02] info : 'redis' stop on user request
[MSK Jan 6 05:10:02] info : monit daemon at 3947 awakened
[MSK Jan 6 05:10:02] info : Awakened by User defined signal 1
[MSK Jan 6 05:10:02] info : 'redis' stop action done
I have:
Ubuntu 12.04.3 LTS
redis-2.8.2
monit-5.3.2
redis instalation path /etc/redis
monit instalation path /etc/monit (installed from apt-get repo)
And following config files:
https://gist.github.com/itsNikolay/665112df34d2eae09330
I had the same problem, and there is no mutch talk about this situation around. I fixed it with another solution, it may concern someone else so I post it here.
in monit configuration file I had
start program = "/etc/init.d/redis start"
stop program = "/etc/init.d/redis stop"
Replacing by the following fixed the problem (with Ubuntu)
start program = "/usr/sbin/service redis start"
stop program = "/usr/sbin/service redis stop"
Just changes owner of /etc/redis dir
$ chown -R root /etc/redis
and restart monit
$ monit restart
The problem is gone. Strange. I wish it helps.
The other day I edited my crontab file, but the old settings are still being run.
I am working with Apache. So I went to
/etc/crontab
and I saved it. But the old crontab is still running. Is this not the place to edit the crontab? Where did I go wrong?
Thanks!
This is my grep cron:
[root]# ps aux | grep cron
root 1396 0.0 0.4 3000 704 pts/0 S+ 21:12 0:00 grep cron
root 8114 0.0 0.5 4412 968 ? Ss 2011 0:02 crond
This is probably a question for some other board, but the answer is that you don't edit cron files directly, you use the tool "crontab" as an executable. run man crontab, or Google crontab.
EDITOR=emacs (or vim or whatever) to set you editor first.
crontab -e
to edit
crontab -l
to list current cron tasks