Question

[1] How can you change the inode associated with a regular file? Specifically, what commands can...

  1. [1] How can you change the inode associated with a regular file? Specifically, what commands can you run that will result in a file that has exactly the same name as before but has a different inode? Please give the commands and explain what each does.
  2. [1] Does a "hole" in a UNIX file affect its logical size? What about its physical size? Explain briefly.
  3. [1] To setup key-based login using ssh, what file do you have to create or change on the remote system? What do you put in it?
  4. [2] What is the difference in behavior between "dd bs=1024 count=10" and "dd bs=2048 count=5" when run in a terminal? Why is there this difference? (You may want to use strace.)
  5. [2] How do you recover an ext4 filesystem using a backup superblock? Show your answer is correct by creating a filesystem, erasing its primary superblock (only), and then recovering the filesystem using a backup superblock.
  6. [2] How could you erase all superblocks (inculding backups) in an ext4 filesystem? Specifically, how could you find them all, and what command could you use to erase each of them (and nothing else)?
  7. [2] When you specify the -a (archive) flag to rsync, it is equivalent to the flags -rlptgoD. Why are each of these flags important to "archiving"? What are two ways that a copy produced with just "-a" won't be an exact copy?
  8. [2] What is one advantage of using key-based logins with ssh? What is one disadvantage?
  9. [2] Can you open a file if you only know its inode number? How does this help explain how inode numbers shown in sshfs don't correspond to the inode numbers on the remote system?
  10. [5] What trace command could you use to do each of the following? Explain each part of the command you give. Hint: you may want to look at the System.map for your kernel in /boot, it has the symbols defined by the current kernel.
    1. Report every time the chdir system call was made along with the directory that was changed to.
    2. Report every time a specific bash process does a write system call.
    3. Report what userspace function called the write system call to a specific bash process
    4. Report every 64-bit call to the clone system call (or every call to clone)
    5. Report every 64-bit call to the execve system call (or every call to execve), reporting the program that was executed.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1. inode- Inode stores the information of a file present on the file system,

The Inode typically contains the mode of access to the file, Information about the owners, disk location where the file is present and the what type of file it is,ID of the device,etc. And it stores all these information in the form of a Data structure.

In Unix there is a Index table containing the inode number which is unique to every inode and uses that number to access the inode content.

ls command is used for listing the files present in the file system.when you add the option "-i" along with the ls command,It displays the output where the inode number is present in the first column.

Every Regular file in the file system has a unique inode that contains the information of that particular file and it can not be changed.Since the file system is the one managing the inode, we can not change it .

So, The only way to get a different inode for the same file is to create a copy of that file.

When you create a copy of the file it will get a new inode which will then contain the information of the new copied file.

To create a copy of a file you need to use "cp" command. The cp command can be used to create a a copy of a file or a whole directory.

$ cp source destination

source is the file you want to create a copy of and destination is the new location where the file will get copied to.

for e.g; $ cp Regfile \Desktop

This will create a copy of the Regfil in the \Desktop with the same name but with different inode.

Another command which can be used to change the inode is the "mv" command which is used for moving or renaming mainly.

If you move the file in the inside the file system ,then the inode will not change and remain the same.So, to get a different inode you must move the file to a different file system. For that you can do;

$ mv RegFile /tmp

here /tmp denotes the different filesystem

so now when you use " $ ls -i /tmp/RegFile" you will see the same file name with different inode number . As mentioned above the file system manages the inode so changing the file system will change the inode number as well.

1. First to understand whether if the hole in a Unix file affects the logical or the physical size of the file you must understand what the hole in a file means,

Hole in a unix file is are the empty spaces that contains null characters and dont take up any space on the disk.

For e.g to create a hole. "dd" command is used.

$ dd If=/dev/holefile bs=1024 seek=7

when you use the above command the /dev/holefile will contain 7168 null characters.

And the holes are not allocated in the disk space.

Logical size signifies the actual data blocks that is used, While the Physical size signifies the total data blocks assigned to the file.A file with holes generally will have a larger logical size than its physical size as the holes in the file are not assigned any data block.One example are the sparse files which instead of using data blocks store the metadata of the holes. and thus there logical size is greater than the physical size.

1. SSH stands for Secure Shell which is used for security of a connection between a client and a server by providing authentication methods.

Steps to setup key based login using SSH-

1.check whether there is any existing ssh key pair to avoid overwriting - $ ls -al home/.ssh/id_*.demo (home denotes the homedirectory can also be replaced by ~)

If you already have a key then you can use that or If you don't already have a existing key pair then

2. Generating a SSH key pair

$ ssh-keygen -t rsa -b 1024 -C "comment"       :this will generate a 1024 bits ssh key pair with the comment you provided.

And press Enter for using the default file name and file location.

3. Now, the ssh-keygen tool will require a passphrase for security purpose, you can either enter a passphrase or just keep it blank and not use it.

4. to list the public and private key generated by SSH you can use

$ ls home/.ssh/id_*   

5.After the key is generated you need to copy the public key to the server so that you are able to manage it.To copy the public key to server use $ ssh-copy-id command ,This will lead to a prompt asking for a password.

6.After authentication the public key will be appended to the remote user file and connection will close.

Now you will be able to log in without using any password using $ ssh

 
Add a comment
Know the answer?
Add Answer to:
[1] How can you change the inode associated with a regular file? Specifically, what commands can...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Linux 1. How can you enable, on a default Linux installation, root remote access through ssh?...

    Linux 1. How can you enable, on a default Linux installation, root remote access through ssh? 2. A boot loader can be configured to boot multiple Linux kernels that use the same partition as their root file system. True or False? 3. Which of the following occurs first when a computer is booted? the BIOS displays a setup menu of configuration options. The kernel starts the init program. The BIOS loads the MBR. The CPU starts executing commands found in...

  • QUESTION 1 What will be the output of following Unix command: find / -name ‘*’ A....

    QUESTION 1 What will be the output of following Unix command: find / -name ‘*’ A. List all files and directories recursively starting from / B. List a file names * in / C. List all files in / directory D. List all files and directories in / directory QUESTION 2 Which command is used to extract a column/field from a text file / input. A. paste B. get C. cut D. tar QUESTION 3 Which command creates an empty...

  • I have included what I need to do for part b, and what I have so...

    I have included what I need to do for part b, and what I have so far. I 2.2 Part B Write a default version of program to report the behavior of the Linux kernel by inspecting kernel state. The program should print the following values to the user screen or console: CPU type and model Kernel version Amount of time since the system was last booted, in thefomdmm:5s (for example, 3 days 13 hours 46 minutes 32 seconds would...

  • Lab 10: ArrayLists and Files in a GUI Application For this lab, you will work on...

    Lab 10: ArrayLists and Files in a GUI Application For this lab, you will work on a simple GUI application. The starting point for your work consists of four files (TextCollage, DrawTextItem, DrawTextPanel, and SimpleFileChooser) in the code directory. These files are supposed to be in package named "textcollage". Start an Eclipse project, create a package named textcollage in that project, and copy the four files into the package. To run the program, you should run the file TextCollage.java, which...

  • Can you piea se Show how 4a 2 got the answer F helps me. understand H better Thant you So much Problem 1 REGIONA...

    Can you piea se Show how 4a 2 got the answer F helps me. understand H better Thant you So much Problem 1 REGIONAL AIRLINES Regional Airlines is establishing a new telephone system for handling flight reservations. During the 10:00 A.M. to 11:00 A.M. time period, calls to the reservation agent occur ran- domly at an average of one call every 3.75 minutes. Historical service time data show that a reservation agent spends an average of 3 minutes with each...

  • could you please help me with this problem, also I need a little text so I...

    could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT