Stop password prompt on MAMP startup - apache

I develop using MAMP pro on my Mac. When I start MAMP it prompts me for a password if I use port 80. If I use a higher port it doesn't prompt me, but I have to append the port number in the URL ( eg dev.local:8888 ).
Does anyone know how to make it not prompt for password when using standard ports?
Thank you.

I've put together an app that allows you to start/stop MAMP's Apache and MySQL without the password request, even on port 80. It stores the password in Keychain, so you only need to enter it once. It has a nice icon too!
Download: http://www.46palermo.com/blog/run-mamp-without-password-easy-way/

According to a living-e rep they are considering adding an option to store the password in the keychain:
http://forum.webedition.de/phpBB/viewtopic.php?f=4&t=5517&p=12019
Update: I pestered Living-e support and got them to add it as a feature request to their bug tracker. The link is here: http://qa.living-e.de/tracker/view.php?id=3648 (requires registration) if you want to follow it.
Another update: Still following this issue. Looks like living-e moved their bug tracker, the new link to this issue is:
http://bugs.mamp.info/view.php?id=3652
It's in German but the Google translation is:
When will start and stop the server in
each case the admin password is
required if port is used as low-1024th
If we could get the password from the
OS X Keychain / keyring, allowed
themselves to avoid annoying popup
ads.
Or a German speaker's translation is:
When the Server starts/stops it will ask for the admin password each time.
If it could get the password from OS X Keychain / Keyring, the annoying popup could be avoided.

As found on Macworld and already mentioned by Tom in the other answer there is a way with applescript! Downside is you have to save your user credentials in plain text.
Open AppleScript Editor
Enter the following code replacing YOURPASSWORD and YOURUSERNAME with your user credentials
Save it as application. You might tick run-only to prevent other users from reading the plain text as a small security measure
do shell script "/Applications/MAMP/bin/startApache.sh &" password "YOURPASSWORD" user name "YOURUSERNAME" with administrator privileges
do shell script "/Applications/MAMP/bin/startMysql.sh > /dev/null 2>&1"
There might be an issue with the correct file path as MAMP apparently changed startmySQL.sh to startMysql.sh in some version, so double check if it's not working!
You can put the new application in the Login Items (System Preferences -> Users & Groups -> Login Items), so the Apache server and MySQL start automatically without even showing up the MAMP-App at startup (silent start).

In response to the commands that were posted:
1) Run MAMP on port > 1024
Running all of the servers on MAMP (nginx, apache, mysql) with port ranges above 1024 allows the Mac OS X account you logged in with to launch the services, so you will not be asked for a password in this instance. Any server that runs below port 1024 requires root privileges when being executed.
2) chmod -R a+w /tmp
This command would recursively go through all files and sub folders in /tmp and make them writable for the current user. When MAMP launches, servers create temporary files in this directory.
Also if you decide you want to run the servers below port 1024 and want a solution with applescript that does not store the password in plain text then see this link applescript password with keychain

I'm now using these two applescripts to start/stop MAMP, you can save startup script is a login item so it's always up when I boot. It does mean storing your password in plain text, as Im the only one using this machine I can live with it, better than typing in my password at least three times a day.

I bind apache to port 8080 and then use port forwarding from 80 to 8080
sudo ipfw add 100 fwd 127.0.0.1,8080 tcp from any to any 80 in
Works for me, but I'm working on making the above script permanent. So far, nothing I've tried sticks, so I just run the command above in terminal after restarting. But you can then freely start and stop MAMP without a password and use a URL without :8080 or :8888.

Its a security issue, and MacOS with its UNIX heritage like security (=Good Thing). That's why MacOS asks for passwords all the time. Not much you can do about it as far as I know.

1) Run MAMP on port > 1024
2) chmod -R a+w /tmp

Related

How to prompt user for username and password on start WSL Ubuntu

I am aware of functions to set a default user or change password for WSL Ubuntu like in askubuntu thread here or official docs.
What I'm looking for is when we do wsl from a cmd, or click the Ubuntu 18.04 LTS from Start Menu, I would like to have the same effect as when SSH into a server, it will ask for name or password. I do not want to automatically sign-in. I figured maybe all I need is to not set any default user, but couldn't find how to do that anywhere.
It seems to do this from a normal Ubuntu distro, I would have to edit it in the Settings > Detail or do it from terminal like here - but that's using gdm, I don't think WSL has that.
I use a workaround to impose password check for privileged users in WSL.
Had created a normal logins with sudo for me and my son in ubuntu2004. Additionaly
created kind of guest login without any privileges and made this login the default. So, after starting with bash, we both need to do su - your_login with usual password check.
that is not possible in WSL. Although you can add users and switch between them.
check this out for more info
This works for WSL2 Debian on Windows 11.
Create a special user (e.g. called "login") with no password, no home directory, and a special shell "/usr/bin/slogin".
The special shell is a script, made executable (chmod 755):
#! /bin/sh
exec sudo /usr/bin/login
Add a line to "/etc/sudoers" to let the special user run "login" without password:
login ALL = NOPASSWD: /usr/bin/login
Finally, make the special user the default user when launching WSL in /etc/wsl.conf:
[user]
default = login
To bypass the "login:" prompt, one could launch wsl with the -u option to choose the user to be something other than the special user ("login"), or use the bash Windows executable. bash can be redirected using a .bash_profile for the special user. But generally if you want to block such workarounds, I think you may have to restrict what Windows executables certain users can run (on Windows side), and do some Windows programming regarding security contexts.

Authentication is not working from PuTTY command line on ngrok

I have a Raspberry Pi set up as a download server at home. To access it from any Windows PC I download Putty and add its parent folder to the Path environment variable.
When accessing it via SSH using Putty GUI or CLI from any PC on my home network, it attempts to login with an SSH key, if it fails it prompts me for a password, and I can login.
I set up an ngrok account to be able to access the server from work (ngrok uses the same address for all users, but each free user gets a specific port, randomized on server reboot).
If i open up Putty's GUI and add the address (0.tcp.ngrok.io) and my port (13495) and click Open, I login normally, SSH key first, if that fails, password prompt, and I can login; as shown in the following picture: Putty GUI Login
However, if I login by command using "putty root#0.tcp.ngrok.io:13495" from the command line or making a Windows shortcut with that command as the target, it reacts as if password authentication is disabled and the only authentication method is via SSH key, which is not the case. (Failed Putty Logins)
I finally attempted to add the SSH key of my work desktop to the authorized_keys file, nothing changed. I can login by GUI using the key, but CLI login still fails.
I have tried resetting all of Putty's settings, redownloading, using Pageant instead of the Putty settings SSH>Auth, nothing works.
I have searched far and wide and delved into the creepy depths of the Internet and cannot find ANYONE with the same problem. If someone does find a post with the same question, well then that post must be running away from me.
Help me, please.
This is starting to get quite irritating.
Thanks in advance.
It's because PuTTY actually ignores everything after the colon (for a consistency with PuTTY psftp and pscp tools, where you specify a path after the colon).
So the putty root#0.tcp.ngrok.io:13495 works like putty root#0.tcp.ngrok.io. That means you actually connect to the default SSH 22 port, not to the 13495.
You have to use the -P switch to specify the non-default port:
putty root#0.tcp.ngrok.io -P 13495

Installing cPanel on LAMP VM instance on Google cloud Compute engine

I have successfully installed LAMP stack on my VM of compute engine. I also installed VestaCP which is generally great but I want to install cPanel. I tried but failed.
Well, At last I have got cPanel installed and run successfully, thanks to Jason McDonald. Here are the steps if someone may need. Assuming you have LAMP installed and running (You may refer Complete Steps to installed LAMP on VM!)
cd ..
wget -N http://httpupdate.cpanel.net/latest
sh latest
After CPANEL is finished installing (an hour or so later), Enter the following command:
/scripts/configure_firewall_for_cpanel
FYI: wwwroot is now: /usr/local/apache/
Enter the following command to connect local to public IP:
/scripts/build_cpnat
Someone else may have a better solution for this, however when you sign up for Compute Engine it doesn't allow you to specify the root password. When you try to login to WHM for the first time, it asks for the root password. So entered the following commands to change the root password:
passwd root
Then change the password to what you want.
You will then need to allow the firewall connections that are required by WHM and CPANEL. I got this working via command line, however it was much more fool-proof using the Google Cloud website.
a. go to https://console.developers.google.com/project
b. click on your project
c. under Compute on the left, click on Compute Engine, then click on Networks.
d. Click "default" at the top
e. Click "NEW FIREWALL RULE" (Each time you create a rule, it won't bring you back to the previous screen, it just sits there. I had to hit the back arrow, and then hit New Firewall rule again. The previous rule I just made was still in the input text fields, I just changed it to the next rule I wanted to add, hit the back button, and kept doing this until I was done.) I would keep in mind for the future that you will have to do this for any port that you wish to because almost all are closed by default (i.e. using port 3306 for Remote MYSQL
Do the following, replacing with each of the following ports. You have to do each port separately, you can't list all the ports at the same time. Do this for ports 2082,2083,2086,2087,2089,2095,2096. (For reference, all ports used by CPANEL are herehttp://cpanel.net/getting_the_most_out_of_your_systems_firewall/)
Hit New Firewall Rule.
Name: allow-
Description: (I left blank)
Source Filter: IP Ranges
Source IP Ranges: 0.0.0.0/0
Allowed Protocols OR PORTS:
Target TAGS: (I left blank)
Hit the "CREATE" button
Hit the Back arrow to go back to the list.
Hit New Firewall Rule.
If the old text is still there, you can change only the Name and the Allowed Ports box to the port number you want to add. Hit the "CREATE" button again, hit the back button, and repeat.
After this you should be able to go to https://:2087 and login to WHM.
Like Amar said, you have to set the rules. I ripped the cPanel firewall table using jQuery so these aren't manually typed. Google makes you create separate rules for inbound/outbound (ingress/egress), so here are the ones I had to make.
inbound-tcp
tcp:20;tcp:21;tcp:22;tcp:25;tcp:26;tcp:53;tcp:80;tcp:110;tcp:143;tcp:443;tcp:465;tcp:783;tcp:993;tcp:995;tcp:2077;tcp:2078;tcp:2079;tcp:2080;tcp:2082;tcp:2083;tcp:2086;tcp:2087;tcp:2095;tcp:2096;tcp:3306;tcp:6277;tcp:24441;
outbound-tcp
tcp:20;tcp:21;tcp:25;tcp:26;tcp:37;tcp:43;tcp:53;tcp:80;tcp:113;tcp:443;tcp:465;tcp:873;tcp:2077;tcp:2078;tcp:2079;tcp:2080;tcp:2089;tcp:2195;tcp:6277;tcp:24441;
inbound-udp
udp:53;udp:465;udp:783;udp:6277;udp:24441;
outbound-udp
udp:53;udp:465;udp:873;udp:6277;udp:24441;

Getting "Received too large SFTP packet" when logging in with Root using WinSCP to Google Compute Engine virtual machine instance

Hi I can login to the GCE VM with WinSCP using my own username, cannot login as root...this is by default according to Google, and can be changed.
Changed like this:
Step 1: Login SSH and Su Root
# sudo su root
Step 2: Change password Root
#passwd root
Step 3: Config SSHD allow Root login
#nano /etc/ssh/sshd_config
PermitRootLogin yes
PasswordAuthentication yes
#service sshd restart (I used ssh as I'm using ubuntu and sshd wouldn't work)
Tried to login as root via WinSCP but I get
"Received too large (1349281121 B) SFTP packet. Max supported packet
size is 1024000 B. The error is typically caused by message printed
from startup script (like .profile). The message may start with
'Plea'." Cannot initialize SFTP protocol. Is the host running a SFTP
server?"
Any ideas?
Received too large SFTP packet. Max supported packet size is 102400 B
Cause:
This problem can arise when your .bashrc file is printing data to the screen (e.g.archey, screenfetch). The .bashrc file runs every time any console shell is initialized.
Solution:
Simply move any scripts that generate output from your .bashrc file to your .bash_profile. The .bash_profile only runs when you create a physical shell session.
NOTE: Just for anyone who comes across this and simply wants to copy files and doesn't matter what file protocol they use. You can just switch file protocol from SFTP to SCP to avoid this issue. Thought it might be worth a mention.
If you used Ubuntu linux and try to connect the server then "Please login as the Ubuntu user" you should sftp as the ubuntu user, not as root.
Try that, hope it will work for you!
Thanks!
Hmmm, I added this in WinSCP in advanced settings under "protocol options":
sudo /usr/lib/openssh/sftp-servers
I can login with my own username and move files now. Although not exactly sure how this works, I think it somehow changes you to root user at login?
More info: https://winscp.net/eng/docs/faq_su
See WinSCP article on Received too large (... B) SFTP packet. Max supported packet size is 102400 B
If … (from the subject [error message]) is a very large number then the problem is typically caused by a message printed from some profile/logon script. It violates an SFTP protocol. Some of these scripts are executed even for non-interactive (no TTY) sessions, so they cannot print anything (nor ask user to type something).
To add to #ThatOneCoder's answer on the cause being too much output from .bashrc: in e.g. Ubuntu, there is also the system wide /etc/bash.bashrc that might be "too wordy" and cause the Received too large SFTP packet error.
It's a "system wide .bashrc", and if you want to execute code for all logging in, that's one location to place it. If you nixed ~/.bashrc and still get the error, check the contents of /etc/bash.bashrc.
It is happening because you haven't given shell access permission to the user.
I faced the same issue trying to login on my ubuntu 16.04 EC2 server as "root" via WinSCP. I spent a lot of time trying to fix it but in the end a simple workaround worked for me.
I ssh into the instance using PuTTY with the username "ubuntu". After this I typed
sudo -i
and with this the user was changed to root.

Change MAMP password to none

How can i use empty password in MAMP?
I tried the command:
/Applications/MAMP/Library/bin/mysqladmin -u root -p password
and edited the config php file but empty password seems not working..(every other password works fine).
What can i do to use empty password?
There is a third party app that runs Apache & MySQL from MAMP without asking for a password each time. It’s quite secure because it uses a stored password locked in the Keychain. It also quits Apache & MySQL when you quit the app itself.
Here is how to use it:
Open the Keychain Access app and click ‘+’ to add a new item. Call the item ‘MAMP’ and enter the account name and password that you use to log in to your Mac.
Download and launch the MAMP No Password app
App is here.