Difference between revisions of "FAQ - Mod 2"
(Created page with "Welcome to the frequently asked questions page for Module 2. As many common questions can come up on Piazza, some of those questions are consolidated here. == Permissions ==...")
Revision as of 15:10, 14 December 2020
Welcome to the frequently asked questions page for Module 2. As many common questions can come up on Piazza, some of those questions are consolidated here.
- 1 Permissions
- 2 One vs Multiple HTML Files
- 3 Instance Storage Space
- 4 SFTP Errors/Trouble Connecting to Apache via VSCode
Help: I need to edit a readonly file!
When attempting to edit a readonly file, the terminal will throw the following warning message.
W10: Warning: Changing a readonly file
This error often surfaces for the first time when attempting to edit UserDir for the first time, as is instructed for setting up Apache. If you have set the correct permissions (as designated by the wiki) and are still running into an error, you likely need to edit the file with the "sudo" command, as shown below.
$ sudo vi <filename>
as opposed to
$ vi <filename>
Placing sudo before a command allows you to run the command with the permissions of the root user. The root user is able to access any file, so running as sudo should allow you to write to a readonly file. Before using sudo to run a command, always check that you have set the correct permissions as stated by the wiki. If you do not, using sudo once will not fix permissions issues down the line. We see plenty of permissions questions on piazza every year; 90% of the time these are due to students not reading the wiki in full when configuring Apache, SFTP, etc.
What is the password to login to the root user on my EC2 instance?
When attempting to login to the root user using "su," you might find yourself prompted to enter a password. Similarly to the previous issue, this can be solved by running the following command
$ sudo su
Using sudo allows you to access the permissions of the root user without using the password.
I'm trying to push files using SFTP but it isn't working
You may run into an error when trying to push files via SFTP, where you see the following message followed by several lines of error tracing.
Error: Permissions Denied
If you run into this, it's likely the case that the permissions were set incorrectly for either your private key or public_html. If you make sure that you have set permissions correctly for both of these, you likely will not have an error.
One vs Multiple HTML Files
Should I include both parts of the assignment in the same HTML file?
Students often wonder whether they should include both the birthday card and search engine in the same HTML file or separate them into different files. While there is no grading requirement for this and they can be included in the same file, we recommend putting them in different files to get you more comfortable with the process of creating HTML files from scratch. In the end, though, this is up to you.
Instance Storage Space
What do I do if I run out of space on my EC2 instance?
While this may seem like a big deal, this is often simply due to an issue in a PHP file that causes errors to pile up in the Apache log folder. Follow the following steps to fix this. First, check to make sure this is the issue. Run the following command. If any of the file systems show 100% for use, you may be out of space.
$ df -h
If this is the case, log into the root user.
$ sudo su
Direct yourself to the Apache log folder.
$ cd /var/log/httpd
Run the following command to see the files in this directory. If you see an abundance of error_log files, or error_log files with large sizes, a PHP file is likely the source of the problem.
$ ls -l
Use the next command to find the PHP file that was the source of the errors. You will need to fix whatever errors you have in your PHP file so that your instance does not fill up again.
Finally, use the following command to remove the error_log files that are taking up all of the space.
Restart Apache after having completed this process and you should have regained space on your instance!
SFTP Errors/Trouble Connecting to Apache via VSCode
Why won't my SFTP work from vscode?
This is often due to an incorrect private key path, which will result in the following error.
ENOENT: No such file or directory, open '<file path>'
This nearly always means that your privateKeyPath field in your sftp.json file is incorrect. Double check this path; it should be the file path to your id-rsa file on your local machine.