Chapter 7: Static Website Hosting (3 OSes × 2 Web Servers)
7.4 Step 2 (common): ways to upload your own files
Friends, the sample site is fine, but in a real project you have to take the files from your laptop to the server. There are three ways – scp, git clone and SFTP tools. Use whichever feels easiest.
मित्रांनो, सॅम्पल साइट ठीक आहे, पण खऱ्या प्रोजेक्टमध्ये तुमच्या लॅपटॉपवरच्या फाइल्स सर्व्हरवर न्याव्या लागतात. तीन मार्ग आहेत – scp, git clone आणि SFTP टूल्स. तुम्हाला सोपा वाटेल तो वापरा.
दोस्तों, सैंपल साइट ठीक है, लेकिन असली प्रोजेक्ट में आपके लैपटॉप की फ़ाइलें सर्वर पर ले जानी पड़ती हैं. तीन तरीके हैं – scp, git clone और SFTP टूल्स. जो आसान लगे वो इस्तेमाल करो.
Option A — scp from your laptop (run where the verified source folder is local and the approved receiving host can be reached):
LAB_SOURCE='REPLACE_WITH_LOCAL_PUBLICATION_DIRECTORY'
LAB_KEY='REPLACE_WITH_APPROVED_KEY_PATH'
LAB_USER='REPLACE_WITH_APPROVED_REMOTE_USER'
LAB_HOST='REPLACE_WITH_APPROVED_TRAINING_HOST'
LAB_PORT=22
LAB_STAGE='REPLACE_WITH_APPROVED_REMOTE_STAGING_PARENT'
scp -i "$LAB_KEY" -P "$LAB_PORT" -r "$LAB_SOURCE" "$LAB_USER@$LAB_HOST:$LAB_STAGE/"
Option B — git clone Use an approved repository and a private authoring or build workspace. Run this with Git already available and only with access to the intended source:
LAB_REPO='REPLACE_WITH_APPROVED_REPOSITORY'
LAB_WORK='REPLACE_WITH_PRIVATE_AUTHORING_DIRECTORY'
git clone -- "$LAB_REPO" "$LAB_WORK/source"
git -C "$LAB_WORK/source" rev-parse HEAD
Option C — WinSCP / MobaXterm / FileZilla (SFTP): connect using the approved host, actual SSH port and required login. Verify the trusted host key before transferring the reviewed candidate into the permitted staging directory.
Stage files before publishing
The upload user needs permission only for its approved receiving folder. Verify the candidate there and follow the site owner’s scoped publishing process. The web server needs appropriate read and directory traversal access. Leave the ownership of existing site directories untouched.
Ravindra Bagale's Tip
Run the upload command where the approved source folder is local. Verify the receiving host, current guest user and allowed stage before copying. Use the configured SSH port and the protected key format supported by your client. Afterward check the received files before publishing.
Ravindra Bagale's Tip – मराठी
मंजूर source folder ज्या machine वर आहे तिथून upload करा. copy करण्यापूर्वी host key, guest user आणि staging path तपासा. Client साठी मंजूर port आणि सुरक्षित key वापरा. Publish करण्यापूर्वी पोहोचलेल्या files पडताळा.
Ravindra Bagale's Tip – हिंदी
स्वीकृत source folder जिस मशीन पर है वहाँ से upload चलाओ। Copy से पहले host key, guest user और staging path जाँचो। Client के लिए स्वीकृत port और सुरक्षित key इस्तेमाल करो। Publish करने से पहले पहुँची हुई files की पुष्टि करो।
Lab
Use the verified sample folder from the previous lesson. In an approved remote lab, transfer it to a new staged location and compare the exact received relative tree before publishing. Otherwise complete the local copy and digest exercises below.
Identify the source and staging destination before transferring bytes
The sample Mauli Dairy site works in a local preview. The next job is to place the approved publication files on an authorized training host. Draw two boxes: the source directory that contains the checked site, and a new receiving directory that belongs to the lab user. Between them write the chosen transfer method and the identity authorized to use it. Keep a third box for the actual web server root. A completed upload places files in the receiving box. Publishing changes what the server serves and is a separate operation.
Write the expected file tree before selecting a tool. In this exercise the home page, rate page, error document and CSS must retain their relative names. If you copy only the HTML files, the browser can receive successful documents and still fail to get the stylesheet. If you put the entire parent directory inside an already named release folder, the published paths may gain an extra layer. The correct result is the intended list of file paths beneath the selected stage, not a transfer progress bar alone.
The destination must be an existing permitted workspace or a new uniquely identified child created for the exercise. Use the correct account and Region to identify any AWS guest. Verify the trusted identity and approved login mechanism. The host can be reachable only over an approved private path. It does not need a public address for this lesson if the transfer method works within the intended network. Do not start a public SSH endpoint just because a copy tutorial displays one.
Students without an approved guest can run the local transfer exercise on paper or in temporary directories. The same file checks show why staging and verification matter. Do not put real private keys, source repositories, credentials or customer records inside the sample publication tree. The file list should contain only what the site owner explicitly expects to distribute. This chapter's sample uses fictional public content.
Choose a transfer method based on where the prepared release already exists
| Source and circumstance | Suitable method to evaluate | Evidence to collect |
|---|---|---|
| Small prepared folder on an approved workstation | OpenSSH scp to a scoped staging directory. | Approved source and destination, confirmed host identity and expected received path and contents. |
| Operator needs an interactive transfer view | Approved SFTP client, using the intended server, login and path. | Correct left and right panes or prompts, completed transfer, then verified destination files. |
| Release committed or built in an approved repository workflow | Check out the intended revision into a private authoring or staging area and prepare its defined publish output. | Exact committed revision and expected output files. Keep repository metadata and credentials outside the public tree. |
| Repeated file synchronization in a managed operation | Approved rsync or deployment tool, previewing the intended source and destination. | Reviewed candidate changes, deletion behavior if selected, and a usable rollback or recovery path. |
In each row the person responsible for the data must know whether the tool sends a file as is, follows a directory tree or copies a generated build. A Git repository that contains a frontend project is normally an authoring source. The browser may need files produced by its documented build. Clone, build, transfer and publish can happen at different times under different roles. A public file service should receive only the approved output rather than every source file the maintainer used.
Choose based on repeatability and authorization as well as convenience. An upload from a student's laptop can work for a small practice tree. A routine team's release should be identifiable by content revision, manifest or artifact. A transfer tool can make the same operation easier to rerun, while the chosen release and policy define what may actually be transferred. The more environments a student controls, the more important it is to verify the destination explicitly.
Read the source and destination arguments of an scp upload
Run an upload on the machine that can read the local source path and reach the approved destination. In the usual laptop exercise that is your laptop. For an authorized transfer from a build machine, it could be that build machine instead. scp can perform transfers in other directions too, so identify which argument is local and which is remote. In the example below, the left path is the local candidate and the right argument includes the remote account, host and known staging parent.
Check the host key using the approved connection procedure. Use the operating system account selected for this lab and the approved private key if this method needs one. Keep its local file outside the publication tree. In OpenSSH the -i flag selects the identity file, -P specifies the port for scp, and -r copies a directory recursively. Current OpenSSH scp typically uses SFTP for its transport. Other versions or flags can behave differently. Use the supported version and normal host-verification policy.
LAB_SOURCE='REPLACE_WITH_LOCAL_PUBLICATION_DIRECTORY'
LAB_KEY='REPLACE_WITH_APPROVED_KEY_PATH'
LAB_USER='REPLACE_WITH_APPROVED_REMOTE_USER'
LAB_HOST='REPLACE_WITH_APPROVED_TRAINING_HOST'
LAB_PORT=22
LAB_STAGE='REPLACE_WITH_APPROVED_REMOTE_STAGING_PARENT'
scp -i "$LAB_KEY" -P "$LAB_PORT" -r "$LAB_SOURCE" \
"$LAB_USER@$LAB_HOST:$LAB_STAGE/"
This example assumes a known existing remote staging parent that your guest user can write. Select an approved simple path in that parent and confirm the source's leaf directory name is absent before transfer. An upload of a directory into an existing parent can produce a child named after the source. If the prepared path ends in mauli-site.release1, inspect the staged child of that name and check its contents. Do not assume it put every file directly into the parent.
Replace every placeholder and choose the documented port if it differs from 22. The command needs the actual directory and authorized identity. Validate that the source contains only the intended release entries before copying recursively. OpenSSH scp can follow symbolic links when copying a tree. The simple lab release should contain no links to other directories or files. Keep approved assets as regular files and carefully review any different behavior in a managed workflow.
A file copy can partially complete if the connection ends or the destination runs out of space. An apparently existing folder isn't proof it is complete. Compare the actual staged paths and content with the source manifest. Use a fresh candidate name when recovering from a partially transferred stage or follow the owner's approved resumption procedure. Leave the currently published directory untouched until the candidate is verified.
Use an interactive SFTP session without confusing the two folders
An SFTP client lets the operator view and transfer files through an authorized SSH-based connection. Its local pane describes the workstation or client environment. The remote pane describes paths available to the logged-in guest account. In a command-line session there are corresponding commands such as lpwd for local working directory and pwd for remote working directory. Read both before copying. It is possible to browse a correct folder on the wrong side of the connection.
Configure the approved host and actual SSH port, remote user and documented authentication. Verify the server host key with a trusted source before accepting it. A file transfer client does not remove the need to verify server identity. The key's expected format depends on the client. Use an approved protected copy rather than sending the private key to the server as a site file. A dialog asking for an address and login is part of the client connection, not a request to upload credentials.
In a permitted graphical client, choose the exact local candidate and approved remote staging folder. Drag only the approved files or the named release folder into the correct receiving path. If asked to replace an existing file, review why the old file is present rather than accepting a blanket overwrite. Some clients can resume or merge transfers differently. Decide whether to use a new candidate path. A clean stage makes it easier to know which files arrived this time.
After the transfer, inspect the remote directory from that session or the approved guest shell. Compare cumulative files, relative names and actual values. A file list or “queue empty” can establish that client calls completed. It doesn't certify that the web server's configured root has moved to those files. Close the transfer session when finished and hand the checked candidate to the authorized publication step.
Use the repository to identify a release without publishing the checkout
Git records versions of source files. A clone can prepare a local copy of an authorized repository, but it does not publish the application. From an approved build or staging workspace, select the intended branch or specific reviewed revision under the team's procedure. A branch name can move. Record the actual commit identifier that was built and the output the web server should receive. Do not clone into an active document root simply to watch changes arrive.
If the repository is private, use the account's approved credential flow. Do not put a long-lived access token in a clone URL saved in history or commit it to configuration. A repository can contain build instructions, tests, internal examples, environment templates and a .git directory. Those entries are not usually needed by a public static server. Preserve the repository outside the public serving tree. Transfer the verified output folder or an archive of the selected public artifact.
A static frontend built from source can output a folder such as dist or another project-defined directory. Read the actual build settings and inspect the result. Some frameworks produce both static output and a server-side part, depending on how they were configured. A clean build can put each component in a different place. Use the course's small four-file release as a model for verifying the final static outputs rather than painting over a project's runtime needs.
When updating, compare one reviewed release with another. If the site update says only the rates changed, the candidate should include the new values and needed shared assets. A Git pull on an existing mutable production checkout can merge local changes or move the branch without prompting the desired review. Use the approved stable build and publication procedure rather than relying on whichever directory was last opened.
Preview a repeated directory copy before permitting a removal
Tools such as rsync can compare a source and receiver and transfer changes. Their detailed flags govern file selection, times, links, permissions and deletion. Learn how a trailing slash changes the source's placement in the receiver. In a common rsync example, a directory argument without a trailing slash can copy its containing name, while a source ending in a slash represents its contents. Read the tool's documented behavior for the exact command and verify a safe preview.
Preview the selected change in an authorized nonproduction destination before enabling any destructive sync option. A deletion option can remove destination files that aren't present in the chosen source. If the destination holds a shared site or a different release, those removals would be outside the intended operation. Do not use broad deletion to clean up a published server root. For learner practice, start with a unique receiving directory and compare its exact expected contents. No deletion is needed to make a new stage clean.
Receipt and activation have different permission needs. The receiving operator can normally write to the approved stage without writing to the web server's active document root. Later the owner can give a separate publishing role permission to deploy approved files. Some authorized directories can accept direct writes, but that does not make a direct overwrite safe. Prefer a staged candidate that can be checked and moved through the project's own publication process. Do not run recursive ownership changes against an existing site to force an upload.
When an upload tool reports “Permission denied,” identify which side and which action was denied. The client might be unable to read a local file, the SSH server may reject the identity, or the authenticated remote user can lack write access to the selected path. Read the scoped error and actual directory. Never remove host verification, reuse broader credentials or make the document root writable to everyone to get past a training failure.
Verify relative paths and actual file bytes after a transfer
Prepare a manifest before copying. For this chapter the manifest can list four paths under the intended site root. That gives new learners a check for missing files and accidental parent folders. A name and byte count help distinguish obvious differences. A SHA-256 digest can also compare content even when a file changes to different bytes of the same length. A checksum is a compact value computed from the bytes; it is useful when compared against a known trusted candidate.
Compare the expected list and digest on both sides. A digest computed from untrusted files alone does not establish the right release. Know which verified build or source snapshot supplied the expectation, and use the same relative path and algorithm for every result. Two directories can have the same total size with different contents. Verifying a home page alone can miss an old rate file or CSS under the wrong name.
Keep manifest and logs out of the public root unless deliberately part of the approved publication. They can contain internal paths, source or release detail. A clean stage can preserve an approved separate manifest, development notes and deployment files without sending them to visitors. If multiple users prepare releases, use their agreed artifact identity and validation rather than comparing two unlabelled copies.
For a web result, a final check still needs the selected document root, host, paths and service response. A stage with matching bytes is necessary for a faithful copy, while read permissions and actual deployment influence whether the user gets the same bytes. The transfer review establishes content completeness. The publish review and approved request establish operational behavior.
Rehearse a partial copy and find the missing asset before publication
Use Python 3 in an approved local workspace. The script creates a small publication tree and two independent stages under one new temporary directory. The first stage deliberately copies only its HTML file, while the second copies the complete tree. It compares exact path sets and SHA-256 values. No remote login or existing site is involved. Predict which stages pass before running it.
python3 - <<'PY'
from hashlib import sha256
from pathlib import Path
from shutil import copy2, copytree
from tempfile import TemporaryDirectory
def manifest(directory):
return {
path.relative_to(directory).as_posix(): sha256(path.read_bytes()).hexdigest()
for path in directory.rglob("*") if path.is_file()
}
with TemporaryDirectory(prefix="mauli-upload-practice-") as tmp:
room = Path(tmp)
source = room / "candidate"
(source / "css").mkdir(parents=True)
(source / "index.html").write_text("<h1>Mauli upload check</h1>\n")
(source / "css" / "style.css").write_text("body { color: #214; }\n")
first = room / "partial"
first.mkdir()
copy2(source / "index.html", first / "index.html")
second = room / "complete"
copytree(source, second)
expected = manifest(source)
for stage in (first, second):
received = manifest(stage)
missing = sorted(set(expected) - set(received))
extra = sorted(set(received) - set(expected))
changed = sorted(name for name in set(received) & set(expected)
if received[name] != expected[name])
print(f"{stage.name}: missing {missing}, extra {extra}, changed {changed}")
(second / "css" / "style.css").write_text("body { color: #124; }\n")
print("same file names after edit:", set(manifest(second)) == set(expected))
print("same publication bytes after edit:", manifest(second) == expected)
PY
Expect the partial stage to report css/style.css missing. The complete stage should initially report no missing, extra or changed paths. After the intentional edit, the same file names statement should be true and the same bytes statement should be false. These outputs distinguish a missing entry from a changed value. You can explain why the browser might show a heading from the partial stage and no styles if it were incorrectly published.
Change the local scenario on paper. Suppose the entire source folder is placed as a child of the intended stage and the manifest is calculated from its parent. It may show extra paths under that added directory and missing paths at the stage root. Decide whether the intended transfer should copy the containing folder or its contents. Verify the eventual root and requested URL instead of moving files blindly.
If the Python exercise reports a permission error, check whether the local environment allows creation of a temporary directory and ordinary files. It doesn't need a privileged account, and it should not be redirected to a live folder. The context manager removes its own scratch copies when the program finishes. If you made a separate scratch script, keep or remove that named file according to your course work.
Build a local archive from one selected Git publication subtree
This optional local exercise needs Git, Python 3 and a shell. It creates a disposable repository with one public training directory and one authoring note. The commands record an example revision and export its public subtree only. There is no remote, repository credential or configured publishing endpoint. The example uses ordinary files and inspects the archive's names without extracting it. An actual project should use its approved artifact and dependency process.
python3 - <<'PY'
from pathlib import Path
from subprocess import run
from tempfile import TemporaryDirectory
import tarfile
with TemporaryDirectory(prefix="mauli-git-artifact-") as root:
work = Path(root)
repo = work / "project"
repo.mkdir()
(repo / "public").mkdir()
(repo / "public" / "index.html").write_text("<h1>Mauli reviewed artifact</h1>\n")
(repo / "author-note.txt").write_text("Fictional authoring note\n")
def git(*args):
return run(
["git", "-C", str(repo), "-c", "core.hooksPath=/dev/null",
"-c", "user.name=Training Author",
"-c", "user.email=training@example.com",
"-c", "commit.gpgSign=false", *args],
check=True, text=True, capture_output=True,
).stdout.strip()
git("init", "--quiet", "--template=")
git("add", "public/index.html", "author-note.txt")
git("commit", "--quiet", "-m", "Training release one")
print("revision recorded:", len(git("rev-parse", "HEAD")) > 0)
out = work / "release.tar"
git("archive", "--format=tar", f"--output={out}", "HEAD:public")
with tarfile.open(out, "r") as archive:
print("regular publication files:", sorted(
entry.name for entry in archive.getmembers() if entry.isfile()
))
PY
The expected output shows that a revision was recorded and that the archive's regular publication file list contains index.html. The author note was part of the temporary revision but is not in the selected subtree. The export lists the contents of that named committed directory. This selection does not make arbitrary committed files safe. You still need the defined public file list and review, particularly when an automated build produces additional output.
If Git is not installed or the local workstation disallows it, use the supplied results and draw the source and artifact side by side. The exact style of revision identifier can vary with repository format. The important proof is that you selected a known committed subtree and reviewed the actual output. The exercise does not clone an external repo, change any global Git setting, publish the archive or leave a retained resource.
Interpret a failed upload before trying it again
| Observed result | What to verify first | Expected remediation evidence |
|---|---|---|
| The client reports a missing local file. | Actual machine and working directory, selected source path and case. | The prepared release exists at the inspected source and contains the intended relative files. |
| The first connection shows a different host key. | Trusted current host identity and intended connection path. | Verified fingerprint under the authorized lab. Do not continue against an unexpected host. |
| The server accepts login but denies the write. | Authenticated account and approved stage path and permissions. | The existing or new authorized receiving directory can accept the intended file. |
| The transfer completes but the site still shows older content. | Active document root, candidate promotion and current response cache. | The correct published version is served from its intended host and path. |
If the approved tool reports a partial copy, leave the active site in place. Compare the incomplete stage and authorized source and determine why it ended. A temporarily disconnected transport can be different from insufficient storage or authorization. Start a fresh scoped candidate or follow the documented resume path after resolving the cause. Verify every required asset instead of trusting the first transferred file.
Preserve a failing observation with a minimal example, such as “approved session connected, unable to write the staged style file under the selected parent.” This report does not need to contain your private key path or all server details. If the file owner or parent directory is different than expected, identify the approved receiving user and location with their owner. A root-owned live directory may be correctly protected even if the same user can write a home stage. Use a new allowed stage for the copy and leave the separate promotion permission intact. An unauthorized folder is not evidence that the entire connection failed.
Once the candidate is ready, note the exact stage path and identity, its checked manifest and which release predecessor is available under the owner's rollback plan. The review belongs before the separate publishing operation. If you have no authorization to activate it, hand over that scoped evidence through the approved course process. An upload changes files on one host; it does not by itself authorize any production release.
Set up an isolated receiving directory and record its exact location
Suppose the authorized training guest has a local home directory for the approved transfer account. Open the established guest session and confirm the intended hostname, user and lab location before creating a receiving path. Use a new directory under the course's approved staging location. The example below is for a shell with ordinary mktemp support, and a guest home permitted for temporary copies. Run it in the intended guest. It returns a concrete path to use as the staging parent when you later run the copy from the client.
hostname
id
lab_received=$(mktemp -d "$HOME/mauli-upload.XXXXXX") &&
printf 'New approved staging parent: %s\n' "$lab_received"
The appended random portion gives the new receiving directory its own name. Record the printed absolute path and stay in the approved guest session only while you need it. Local and remote shell variables do not automatically share values. Fill in the client upload's stage variable using the actual approved receiving path, not the string $lab_received copied from a different shell. If the line does not print a new path, check local authorization and quota in that environment. Do not redirect the upload into an active document root as a fallback.
After the copy, reopen the approved guest session if needed and inspect the exact newly received child path. A source with the basename release-one inside the parent should give a candidate by that name under the common recursive scp behavior. Compare the intended manifest, selected revision marker and peer ownership. Don't publish an extra nested directory simply because the transfer created it. Use the actual document root expected by the next lab.
If the school policy already provides a managed stage, skip the creation command and inspect that assigned path. If the guest has no suitable writable location, use the local exercise or ask its owner to provide one. At the end either hand off the approved checked artifact or remove only the exact scratch files or directory you created, after confirming no later exercise needs them. None of these steps changes an existing host configuration.
Account for local path syntax, ports and metadata before copying
A Windows learner sees a file called style.css in a file browser while the actual saved name has an additional extension. Another learner uses a path containing spaces and the command treats it as several arguments. Start with the actual filesystem view and check the current source directory. A quoted path lets a shell pass one argument, but different operating systems use different path syntax and shells evaluate quoting differently. Use the supported client and prepare the exact pathname it expects.
Uppercase and lowercase switches can mean different things. In OpenSSH scp, uppercase -P supplies the connection port and lowercase -p requests preservation of specified file times and mode bits. Choose the documented defaults unless you have a reason to change them. Preservation of a timestamp is not an access-control solution and can affect tests that infer current content from times. Verify writers and readers under the actual destination policy. Name the connection and file-selection options separately in your worksheet.
Understand when an archived artifact is a reasonable transfer input. An archive can carry multiple paths as one object for checking. Before extracting a trusted approved artifact, inspect the expected member names and types. Use a fresh isolated staging directory and the project's supported safe extraction process. Do not unpack an unexplained archive over an existing root or assume filenames and links inside it match the published manifest. This lesson's generated local archive contains only a known regular file and its members are inspected without extraction.
For a simple site, copying normal public files is often enough. Use a small transfer record with source host, directory, chosen client, remote host and expected stage. If a client setting changes, verify the actual selected host and supported connection parameters rather than changing the site's file data. If a path is ambiguous, inspect both sides before starting. A repeated failed command with a different current directory can leave an extra candidate you did not intend.
Distinguish a push from a pull in a shared release process
In the ordinary student transfer, the approved client sends files to the guest. In a managed workflow a build service can prepare an approved artifact and the receiving environment can retrieve it from a designated repository or object store. These flows give different actors responsibility for authentication, network and verification. A host able to accept an inbound SSH transfer under one approved path may not be allowed to contact a source repository for an outbound pull. Start with the required direction and service boundaries.
Sketch a workstation push. The learner controls the verified candidate, authenticates through the approved SSH path and writes to a limited stage. The instructor or deployment role checks the artifact and decides whether to activate it. Then sketch an artifact pull. An approved build stores a versioned candidate in the permitted release store. The receiver needs a trusted reference, permission and network access instead of a student private key. The exact method can vary, but both need an identifiable artifact and scoped receiving path.
A common mistake is letting one person's writable source and the running host's credentials both define the current release without review. A build can use a moving branch or pull a different dependency if nothing is recorded. Keep a reviewed revision and output manifest under the chosen procedure. If the cloud worker retrieves an approved object, grant only the intended operation for that object or prefix. Authentication to the store does not automatically prove the content was the version your team reviewed.
Decide who validates the final artifact and who can make it active. This separation is useful on a server hosting several sites. The candidate for Mauli can be read, inspected and compared without allowing it to replace a different site. Keep checks attached to one root and known response. If a transfer uses a new account, update owner and scope records before requiring another operator to continue. A progress confirmation is less meaningful than a well-scoped change history.
Handle an interrupted transfer without guessing which files are current
Mauli begins copying a release with four files. A login session ends midway. The receiving stage now contains the home page and part of the expected stylesheet. A listing shows both names and the website author wants to publish immediately. The correct result is still unproven. Check received counts and contents against the approved source. A partial file can have a familiar name and a plausible size. A verified stage needs the complete relative tree and matching intended bytes.
Use the approved transfer tool's documented resume behavior or begin again with a fresh stage. A retry should store only the candidate files it owns in the intended receiving path. Avoid merging two incomplete versions into one active folder. If the destination ran out of space, check quota and scope with its owner rather than deleting unknown files to proceed. If the host key changed at the same time, verify server identity before any resume. Failure at transport can coincide with other changes, so use observed facts.
Promotion happens after the candidate passes. A real team might switch a controlled versioned directory or approved reference once it has tested the required content and configuration, rather than serving files while a copy continues. File moves and references can behave differently across filesystems, operating systems and tools. The lesson asks you to know the actual deployment process and verify its live response. Retain the approved previous configuration and release under the scope rules for a realistic recovery.
After the final authorized step, list one test result for the name and home page, one for the stylesheet and one for a known absent path. Check the release marker from the expected route. If you only tested the local candidate or staging result, report that accurately. A stage can pass while a cache or a different document root continues serving the old content. The test is complete when the owner can say which artifact moved, where it belongs and what actual evidence proves the result.
Practice a transfer record with a checkable destination
Draw both sides of a planned upload and a third final serving directory. Write the machine, local or remote path and expected relative files for each. Mark where the private key stays and where a trusted host can be verified.
Predict what happens when an entire folder is copied to an already existing staging parent. Give the expected child path for one named candidate. Show how to verify whether the site files arrived at the intended level before publishing them.
Given a repo with internal source, a tested public build and a private config template, write which files should be staged and how you identify the reviewed revision. Explain why a fresh clone is not the same thing as a verified public release.
The checksum study reports no missing path but one changed CSS file. Describe two plausible reasons and one permitted comparison that distinguishes them. State which expected content and MIME test still must happen after the approved publish.
Interview questions and worked answers
Why stage uploads before changing what the web server serves?
A fresh stage lets the owner verify expected files and content before promotion. A transfer might be incomplete or have the wrong relative paths. Publishing separately allows the prior approved release to continue while the candidate is checked.
Why can a recursive scp upload produce a different path than expected?
When the destination is an existing parent, the source directory can appear as a child with its own name. The web server might still look for files directly under another root. Inspect the received relative tree and intended publication mapping before shifting content.
What does a successful SFTP queue not establish?
It shows that the client reports completing the queued transfers. Verify the intended remote path and exact files, and check a useful HTTP response after a separately authorized publish. Transfer success cannot select the site's document root or certificate.
Why avoid serving a repo clone directly?
A clone can include source, metadata and material that was never approved for public delivery. The application may also need a build. Record the reviewed revision and publish only the intended prepared artifact under the owner's process.
How do you verify content beyond file sizes?
Use a known expected list and compare actual file bytes or a trusted checksum for each relative path. Byte counts alone can match while content differs. Then verify the same approved resources from the intended browser or HTTP client after activation.
Check which action proves a correct transfer
The HTML files arrived but
css/style.cssis absent. What does this show? A. The candidate transfer is incomplete. B. The CSS must load from the private key. C. HTTP always returns all related assets with HTML.Show answer
A. Each asset is a separate required file. Correct the staged candidate before publishing. A successful request for the HTML does not prove an independent stylesheet is present.
Where should a reusable private key remain? A. Inside the public release. B. In the approved credential store or protected client location. C. In a website download.
Show answer
B. The client uses it for authentication under its approved method. It is never a site asset. Check the host key separately to verify the intended remote service.
What is the best initial destination for a beginner's authorized upload? A. A distinct scoped staging directory. B. Every site root on the server. C. The server's package directory.
Show answer
A. Stage the known candidate and verify its file tree before any approved publication. Changing a shared or unrelated directory can disrupt other sites and is outside the exercise.
Two files have the same name and size but different digests. What follows in this exercise? A. Their contents require comparison and the staged value differs from the expected source. B. Both are guaranteed byte-identical. C. The remote host's operating system directory changed.
Show answer
A. A trusted expected digest and computed digest provide evidence about the bytes. Check exact relative paths and expected release rather than assuming file size or basename establishes content.
Why identify the exact Git revision and output directory? A. Branch contents and build outputs can change. B. Git changes every domain's DNS record. C. An authoring directory must always be published in full.
Show answer
A. A specific reviewed revision and artifact identify what was tested. Publish only the intended output. A mutable branch or unreviewed checkout may include a different version or private material.
Revision cards
- Source and destination
- Identify machine, login, actual path and intended relative files on both sides.
- Stage before publish
- Verify an approved candidate outside the active root. Activation is a separate operation.
- Secure transfer
- Use the approved route and key. Verify server identity and keep private credentials out of publication.
- Directory levels
- Check whether the containing folder or its contents were copied. Map the final relative paths to the site.
- Known revision
- Keep the repository and source outside the public tree. Transfer the approved built output.
- File and HTTP evidence
- Compare manifest and bytes in the stage, then verify the intended site responses when published.
References
- OpenSSH scp flags, transport and source formats
- OpenSSH SFTP command and transfer behavior
- OpenSSH server verification and identity
- rsync directory, preview and deletion semantics
- Git clone source and destination
- Git archive and selected tree handling
- Git revision names and identities
- Python SHA-256 digest operations
- Python isolated temporary directories
- Inspect a tar archive's members
- AWS EC2 SSH prerequisites
- Nginx static-file publishing and root mapping