CIFS (Common Internet File System) how to mount file from network sharing folder Ubuntu

CIFS stands for Common Internet File System. It's a network file system protocol that allows computers to share files and printers over a network. It's widely used in Windows environments but can also be used on Linux and macOS systems.

 

 

Create a Mount Point:

 

Bash
sudo mkdir /mnt/vbox

 

Mount the Share: Use the following command to mount the share:
Bash
 

sudo mount -t cifs //server_ip_address/share_name /mnt/mount_point -o username=your_username,password=your_password

 

To ensure that files created within a CIFS mount are owned by root, you can use the uid and gid options when mounting the share:

sudo mount -t cifs //server_ip_address/share_name /mnt/mount_point -o username=your_username,password=your_password,uid=0,gid=0

 

uid 0 = user root

gid 0  = group root


To view the UID (user ID) and GID (group ID) of files and directories using the ls command on Ubuntu, you can use the -l option:
Bash

ls -l

Gunakan kode dengan hati-hati.

This will display a long listing of files and directories, including the following information for each:

    Permissions: The file permissions in the format rwxrwxrwx (read, write, execute permissions for owner, group, and others).
    Link count: The number of hard links to the file.
    Owner: The username of the file owner.
    Group: The group name of the file.
    File size: The size of the file in bytes.
    Modification date: The date and time the file was last modified.
    Filename: The name of the file or directory.

To see the numerical UID and GID instead of the usernames and group names, you can use the -n option:
Bash

ls -ln

Gunakan kode dengan hati-hati.

This will display the numerical UID and GID in the owner and group columns, respectively.

Example:

-rw-r--r-- 1 user_name group_name 1024 Nov  6 12:34 file.txt

In this example:

    -rw-r--r--: The file permissions
    1: The number of hard links
    user_name: The owner of the file
    group_name: The group of the file
    1024: The file size in bytes
    Nov 6 12:34: The modification date and time
    file.txt: The filename

If you need more detailed information about a specific file, you can use the stat command:
Bash

stat file.txt

Gunakan kode dengan hati-hati.

This will display a wealth of information about the file, including its inode number, block size, access time, modification time, change time, and more.


 

Laravel HTTPS routes

Ringkasan ini tidak tersedia. Harap klik di sini untuk melihat postingan.

Laravel TimeZone not working

I am using Lumen framework. How can I change Timezone to Europe/Paris CEST?

I added a variable in my .env file:

APP_TIMEZONE=Asia/Jakarta
 

here it's

 

If you want to manage your timezone from .env file, then you can add below code in your config.php file.

'timezone' => env('APP_TIMEZONE', 'UTC'),

and add the below line in your .env file.

APP_TIMEZONE='Asia/Jakarta'

Remove “api” Prefix from URL on Laravel

PHP Laravel Framework makes it easy for us to create a Restful API. We just set the routing in the Routes -> api.php section.

By default we will find that we will be given a url like this http://ourdomain.com/api/[end-point]

This is to distinguish between urls that can be accessed via the web or can only be accessed through api. We want to change it to http://ourdomain.com/[end-point] by removing the “api” prefix.

To change it we just go to the RouteServiceProvider.php file in the app/Providers folder

Then in the mapApiRoutes method function section, we can eliminate the prefix (‘api’)

 

public function boot(): void
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
});

$this->routes(function () {
Route::middleware('api')
// ->prefix('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));

Route::middleware('web')
->group(base_path('routes/web.php'));
});
}
 

 

#source : https://medium.com/@arthajonar/remove-api-prefix-from-url-on-laravel-35ed585f3a53

Add Public to asset path in Laravel

 I want to install laravel in shared hosting and I followed the steps here https://stackoverflow.com/a/28449523 but my asset path doesn't include the public directory

Instead of this

<link href='http://example.com/public/assets/css/style.css' type='text/css' media='all' />

I'm getting this

<link href='http://example.com/assets/css/style.css' type='text/css' media='all' />

How do I change the directory of the asset folder(add public to assets) without changing any core classes?


Add ASSET_URL=public in your .env file and run php artisan config:cache

Livewire 3 Customizing the asset URL / Livewire3 is not working without PHP artisan serve

 

You can try reference the livewire assests from AppServiceProvider.php

use Illuminate\Support\ServiceProvider;
 

use Livewire\Livewire;

use Illuminate\Support\Facades\Route;


 

class AppServiceProvider extends ServiceProvider
{
    public function boot(): void
    {
        Livewire::setScriptRoute(function ($handle) {
            return Route::get('/example-app/livewire/livewire.js', $handle);
        });

        Livewire::setUpdateRoute(function ($handle) {
            return Route::post('/example-app/livewire/update', $handle);
        });


    }
}