Wrong entry in /etc/deny.hosts file - linux

I mistakenly edited the /etc/deny.hosts file and added following entry-
ALL: ALL. Now, I'm unable to do SSH into it. After searching, I found that it denies all users from accessing the system. Does any one have idea on how to overcome this?

If the Root device of the Instance is an EBS, below steps will help you to come out of the situation.
Stop the Instance (Instance1)
Detach the Root Volume
Attach the Volume to a different running Instance (Instance2) as a non-Root device.
Mount the device on Instance2
Find the newly attached volume name using lsblk and then try to mount the volume.
Edit the deny.hosts file, it will be under /mountpath/etc/deny.hosts
Detach the Volume from Instance2 and re-Attach it to the Instance1 as Root Device.

Related

How to add another volume to Linux if /dev/xvda through /dev/xvdz in use?

I have a scenario where my linux machine is already using disks attached from /dev/xvda through /dev/xvdz. (I have a raid 10 of the ephemerals, a root drive, and an attached EBS volume) I need to add another EBS volume to this server. Is there any other device reference I can use to attach it? I am not familiar enough with this device reference feature to know what I can alter in the name to attach it.
Thanks for your help.
I was able to locate more information on this:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html
I used /dev/xvdba as a new device reference. This solved my problem.

How can I monitor other mount namespace?

I'm developing daemon monitoring SD card directory with using fanotify.
But, all users have their own mount namespace, so daemon can't receive fanotify event though user app writes SD card (same directory with above).
How can I monitor all mount namespace?
Each mount point needs to be manually added by fanotify_mark().
Here is is a good example:

How to access hidden mounts in linux

In my linux box, i can able to access one mount path, which is not present in /etc/fstab or /etc/mtab.
I want to disable that mount point. Please help me with the command to show the hidden mount.
Below is the hidden mount in some xxx machine.
/net/bnrdev/bld-views/build
Above path present in bnrdev machine:
/bld-views/build
These are not "hidden" per se, but NFS mounts found by your system.
You can get rid of this functionality by disabling NFS client services, or just the automount daemon.
WARNING - this will likely break automounted home directories, which could cause issues for other system users.
Please! for the LUV of all things cute & cuddly, make a copy of the files you modify. Justin Case could have an issue with your changes, right as you're falling asleep.

Can I/How do I force micro-SD card to r/w mount?

I have a sandisk 64GB microSD card that I've been using in my phone. It recently started refusing to let me save things to it on the phone and I am currently trying to figure out if it's possible to fix the problem.
I have an SD card slot on my Kubuntu laptop and SD card adapter that I'm using to plug in and attempt to mount the microSD with. The problem is persisting though.
I can mount the card as read-only without a problem and have access to everything on it (which I've now copied off) and everything seems to be intact.
I get problems as soon as I try to mount with write access. Using the following command
sudo mount -o rw,umask=000 /dev/mmcblk0p1 /media/exfat/
I get this output:
'WARN: volume was not unmounted cleanly.
ERROR: fsync failed.'
and it doesn't mount.
If I use sudo mount -o ro,umask=000 /dev/mmcblk0p1 /media/exfat/
I still get this error 'WARN: volume was not unmounted cleanly.'
but it mounts and I have full access.
Does anyone know if this is salvageable or should I just give up now and get a new one?
Any help would be gratefully received.
I had a similar situation but after trying all sorts of things over many minutes of frustration, I discovered there is a tiny 'read-only' switch on the side of the SD card adaptor. Doh.

Amazon EC2 instance's var/www folder mounted on ubuntu machine freezes after some time

I am using virtual box to run Ubuntu on my machine. I mount the /var/www folder of my amazon instance to my ubuntu machine using sshfs. But lately, I have been always experiencing that after ten minutes or so, the mounted drive freezes and I am unable to touch the files anymore. Even gEdit freezes and I have to always turn the machine off and put it on again to mount the drive again and work on the files. This way, my development is becoming really slow and boring.
Please let me know if there is a way I can solve this freezing or if there is a different way( other than mounting ) of accessing the files of amazon instance live and edit them and save them then and there.
Thanking you all for your time.
I solved this problem myself by mounting the ec2 drive on windows using WinSSHFS and so I didnt need to be dependent on my virtual machine to access the files of my ec2 instance. Win SSHFS asks for amazon private key file. Make sure to open the file in notepad and split the lines into small lines, ie; one line should not have more than 64 chars. Only after doing this, Win SSHFS accepted the private key file.
Make sure that the details in WinSSHFS are saved by clicking on the save button before mounting is attempted. Normal username is ec2-user. Enter the drive name you want to mount and mount to any logical drive.

Resources