Normal permissions for /etc/ are:
rwx r-x r-x root root
chmod 741 /etc/ means to set the permissions /etc/ to
rwx r-- --x.
Notice the lack of
r in the third field. These three fields represent: Owner, group, others. Since the default owner and group is root you just prevented everyone except root from reading files in /etc/. This is a bad thingtm.
If you get a root prompt then you can revert these changes easily enough, but for that you need:
- Either an already open root prompt.
- A way to log in as root or any uid 0 account.(You need to manually set this in Ubuntu.)
- Right to
sudo (which you just broke).
- Or access to the filesystem from another OS.
- Or reinstall the system. (Easiest to do if you just set it up a few minutes ago, but also the least educative way)
For a normal desktop or a server with remote access card (HP ILO, Dells DRAC etc) I would boot into single user mode, provide the root password if needed, and fix the permissions.
Or I would boot from a liveCD (or pendrive) and do the same.
On Amazon this is a bit harder because you have no physical access. However you can start a second instance and mount your old OS disk from there.