python bind socket.error: [Errno 13] Permission denied
You can't bind to port numbers lower than 1024 as a unprivileged user.
So you should either:
- Use a port number larger than 1024 (recommended)
- Or run the script as a privileged user
Harder, but more secure solution if it's really necessary to accept from 111:
- Run the as unprivileged on a higher port, and forward port 111 to it externally.
Python socket.error: [Errno 13] Permission denied
You are trying to send to a broadcast address. It is not allowed, see manpage for sendto(2):
EACCES (For UDP sockets) An attempt was made to send to a network/broadcast address as though it was a unicast address.
Set the SO_BROADCAST option, if you actually mean to send to a broadcast address:
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
socket.error: [Errno 13] Permission denied when creating a fake email server
In unix (Linux, Mac OS X, BSD etc) systems, ports less than 1024 can not be bound to by normal users, only the root user can bind to those ports.
To get around this, you could run your python application as root (by using sudo), however this is not preferable. Is it possible instead to get your Flask application to talk to localhost on a higher port, say 2525? You would then need to modify the command you are using to start the smtp server to bind on port 2525 rather than 25.
PermissionError: [Errno 13] Permission denied in python project
You need to run with sudo
, as stated in the installation instructions you linked. As you see, the error comes from trying to bind a socket to a port. Most probably it's trying to use a privileged port (<1024), which can only be done with elevated permissions (ie sudo
).
OSError: [Errno 13] Permission denied message while trying to run python3 -m pyftpdlib -p 21
Usually these errors gets resolved by running the command as administrator.
You should be extremely careful with running non-verified software as admin tho, as it may compromise your computer.
But never the less, it looks like you're attempting to run a FTP server. Here's a writeup about why only root can listen to ports below 1024. This link might get rekt, but until then, that's a decent source of information.
Later in the comments we found out that the library you're using got installed as user, so installing that via pip
as administrator also helps :)
PermissionError: [Errno 13] Permission denied Flask.run()
You're trying to run the app on a privileged port (81) - if you use a higher port such as 5000 you won't need sudo privileges.
Flask PermissionError: [Errno 13] Permission denied
Since I had installed the Python 3.5 separately in a different path, I had to place the following shebang at the top of my file to fix the issue:
#!/opt/mount1/python35/bin/python3.5
Related Topics
While Do Loop and Variables in a Bash Script
Squid: How to Disable Authentication
How to Copy Folder with Files to Another Folder in Unix/Linux
Unix - Count of Columns in File
How Is It Possible That Kill -9 for a Process on Linux Has No Effect
How to Prepend a Directory the Library Path When Loading a Core File in Gdb on Linux
How to Export Dbus_Session_Bus_Address
Detecting a Chroot Jail from Within
Join on First Column of Two Files
Deleting String Up to the First Occurrence of Certain Character
How to Force Cp to Overwrite Without Confirmation
Create a Dedicated Folder for Every Zip Files in a Directory and Extract Zip Files
Linux/Bash, Using Ps -O to Get Process by Specific Name