几天前我安装了 Ubuntu 25.04,上次更新后,应用程序启动器屏幕上出现了一个名为“Fortune”的新幽灵图标,这个 Fortune 在应用中心不存在并且没有安装,我无法删除它'
主页
在将其标记为重复之前,请注意我已经尝试了此线程中的所有解决方案
我的 /etc/samba/smb.conf
# Sample configuration file for the Samba suite for Debian GNU/Linux.
#
#
# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options most of which
# are not shown in this example
#
# Some options that are often worth tuning have been included as
# commented-out examples in this file.
# - When such options are commented with ";", the proposed setting
# differs from the default Samba behaviour
# - When commented with "#", the proposed setting is the default
# behaviour of Samba but the option is considered important
# enough to be mentioned here
#
# NOTE: Whenever you modify this file you should run the command
# "testparm" to check that you have not made any basic syntactic
# errors.
#======================= Global Settings =======================
[global]
## Browsing/Identification ###
# Change this to the workgroup/NT-domain name your Samba server will part of
workgroup = WORKGROUP
# server string is the equivalent of the NT Description field
server string = %h server (Samba, Ubuntu)
#### Networking ####
# The specific set of interfaces / networks to bind to
# This can be either the interface name or an IP address/netmask;
# interface names are normally preferred
; interfaces = 127.0.0.0/8 eth0
# Only bind to the named interfaces and/or networks; you must use the
# 'interfaces' option above to use this.
# It is recommended that you enable this feature if your Samba machine is
# not protected by a firewall or is a firewall itself. However, this
# option cannot handle dynamic or non-broadcast interfaces correctly.
; bind interfaces only = yes
#### Debugging/Accounting ####
# This tells Samba to use a separate log file for each machine
# that connects
log file = /var/log/samba/log.%m
# Cap the size of the individual log files (in KiB).
max log size = 1000
# We want Samba to only log to /var/log/samba/log.{smbd,nmbd}.
# Append syslog@1 if you want important messages to be sent to syslog too.
logging = file
# Do something sensible when Samba crashes: mail the admin a backtrace
panic action = /usr/share/samba/panic-action %d
####### Authentication #######
# Server role. Defines in which mode Samba will operate. Possible
# values are "standalone server", "member server", "classic primary
# domain controller", "classic backup domain controller", "active
# directory domain controller".
#
# Most people will want "standalone server" or "member server".
# Running as "active directory domain controller" will require first
# running "samba-tool domain provision" to wipe databases and create a
# new domain.
server role = standalone server
obey pam restrictions = yes
# This boolean parameter controls whether Samba attempts to sync the Unix
# password with the SMB password when the encrypted SMB password in the
# passdb is changed.
unix password sync = yes
# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Ian Kahan <<[email protected]> for
# sending the correct chat script for the passwd program in Debian Sarge).
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
# This boolean controls whether PAM will be used for password changes
# when requested by an SMB client instead of the program listed in
# 'passwd program'. The default is 'no'.
pam password change = yes
# This option controls how unsuccessful authentication attempts are mapped
# to anonymous connections
map to guest = bad user
########## Domains ###########
#
# The following settings only takes effect if 'server role = classic
# primary domain controller', 'server role = classic backup domain controller'
# or 'domain logons' is set
#
# It specifies the location of the user's
# profile directory from the client point of view) The following
# required a [profiles] share to be setup on the samba server (see
# below)
; logon path = \\%N\profiles\%U
# Another common choice is storing the profile in the user's home directory
# (this is Samba's default)
# logon path = \\%N\%U\profile
# The following setting only takes effect if 'domain logons' is set
# It specifies the location of a user's home directory (from the client
# point of view)
; logon drive = H:
# logon home = \\%N\%U
# The following setting only takes effect if 'domain logons' is set
# It specifies the script to run during logon. The script must be stored
# in the [netlogon] share
# NOTE: Must be store in 'DOS' file format convention
; logon script = logon.cmd
# This allows Unix users to be created on the domain controller via the SAMR
# RPC pipe. The example command creates a user account with a disabled Unix
# password; please adapt to your needs
; add user script = /usr/sbin/useradd --create-home %u
# This allows machine accounts to be created on the domain controller via the
# SAMR RPC pipe.
# The following assumes a "machines" group exists on the system
; add machine script = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u
# This allows Unix groups to be created on the domain controller via the SAMR
# RPC pipe.
; add group script = /usr/sbin/addgroup --force-badname %g
############ Misc ############
# Using the following line enables you to customise your configuration
# on a per machine basis. The %m gets replaced with the netbios name
# of the machine that is connecting
; include = /home/samba/etc/smb.conf.%m
# Some defaults for winbind (make sure you're not using the ranges
# for something else.)
; idmap config * : backend = tdb
; idmap config * : range = 3000-7999
; idmap config YOURDOMAINHERE : backend = tdb
; idmap config YOURDOMAINHERE : range = 100000-999999
; template shell = /bin/bash
# Setup usershare options to enable non-root users to share folders
# with the net usershare command.
# Maximum number of usershare. 0 means that usershare is disabled.
# usershare max shares = 100
# Allow users who've been granted usershare privileges to create
# public shares, not just authenticated ones
usershare allow guests = yes
#======================= Share Definitions =======================
# Un-comment the following (and tweak the other settings below to suit)
# to enable the default home directory shares. This will share each
# user's home directory as \\server\username
;[homes]
; comment = Home Directories
; browseable = no
# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
; read only = yes
# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
; create mask = 0700
# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
; directory mask = 0700
# By default, \\server\username shares can be connected to by anyone
# with access to the samba server.
# Un-comment the following parameter to make sure that only "username"
# can connect to \\server\username
# This might need tweaking when using external authentication schemes
; valid users = %S
# Un-comment the following and create the netlogon directory for Domain Logons
# (you need to configure Samba to act as a domain controller too.)
;[netlogon]
; comment = Network Logon Service
; path = /home/samba/netlogon
; guest ok = yes
; read only = yes
# Un-comment the following and create the profiles directory to store
# users profiles (see the "logon path" option above)
# (you need to configure Samba to act as a domain controller too.)
# The path below should be writable by all users so that their
# profile directory may be created the first time they log on
;[profiles]
; comment = Users profiles
; path = /home/samba/profiles
; guest ok = no
; browseable = no
; create mask = 0600
; directory mask = 0700
[printers]
comment = All Printers
browseable = no
path = /var/tmp
printable = yes
guest ok = no
read only = yes
create mask = 0700
# Windows clients look for this share name as a source of downloadable
# printer drivers
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no
# Uncomment to allow remote administration of Windows print drivers.
# You may need to replace 'lpadmin' with the name of the group your
# admin users are members of.
# Please note that you also need to set appropriate Unix permissions
# to the drivers directory for these users to have write rights in it
; write list = root, @lpadmin
[media]
comment = Medias
path = /home/vincent/Media
read only = yes
browsable = yes
public = yes
guest ok = yes
guest only = yes
mangled names = no
/home/vincent/Media 和内容具有 755 权限
我重启了 samba 服务
sudo service smbd restart
然后,在另一台 Ubuntu 电脑上,我用 Nautilus 连接到网络,找到我的服务器,点击它并选择媒体共享。登录弹出窗口出现,我选择“以匿名方式连接”,然后点击“连接”。结果出现错误:“无法访问位置,无法挂载 Windows 共享:权限被拒绝”。
如果我尝试以注册用户身份连接,用户名为 guest,域为 WORKGROUP,密码为空,然后连接时会收到“无法访问位置,无法挂载 Windows 共享:无效参数”
在启动器中输入时,通常会出现“字符”和“时钟”的结果。
这两种结果对我来说毫无用处,它们使结果视图变得混乱,因此更难看到相关结果。
我该如何配置启动器以不显示这些类型的结果?
启动器显示“字符”和“时钟”结果的屏幕截图:
我想构建一些源,但它们有一长串的依赖项,是的,我可以手动执行操作 - 构建后然后删除已安装的每个 pkg - 但我认为这个问题一定有更好的解决方案。
- 另外还有一个问题,apt 会将已安装软件包的标记从自动更改为手动,这让我犹豫是否一次性删除所有软件包
抱歉,我提出了多个问题,但我认为它们是相关的。
我打算卖掉我的笔记本电脑,它装的是 Windows 11 系统。我刚刚恢复了出厂设置,重启电脑进入恢复模式(开始菜单 - [Shift]+Restart),然后执行恢复出厂设置并完全擦除磁盘。问题是,恢复出厂设置后,电脑会要求输入区域设置和其他信息,我想把这些设置留给新主人,但我找不到非强制关机就能关机的方法。按电源键只会让电脑进入睡眠模式,我找不到任何从操作系统关机的方法。
我已将设备与我的 Microsoft 帐户断开连接,一切正常,但是当 Windows 开始询问区域设置信息时,如何在不进行硬重置的情况下将其余设置(区域设置等)留给新主人?
会对任何能让计算机保持良好状态以便新主人按照自己喜欢的方式进行设置的方法感兴趣。
我在 Excel 中有一个数字列表,希望将其显示为英尺和英寸。
例如,对于以英寸为单位的单元格 A1,我将 B1 设置为
=QUOTIENT(A1,12) * 100 + MOD(A1,12)
然后我将 B1 设置为自定义格式
0' 00.0\"
当 A1=22.5 时,此方法有效,我得到 B1=1' 10.5" 但当 A1=21.0 时,我得到 B1=1' 09.0"
我尝试了以下
0' 0.0\" => 10' 9.0"
0' #0.0\" => 1' 09.0"
0' ##.0\" => 1' 09.0"
0' #.0\" => 10' 9.0"
我无法使用宏来实现这一点,因为正在使用的机器禁用了宏。问题是,我该如何隐藏自定义格式中的前导零,以便
1' 9.0"
1 和 9 之间的两个空格无关紧要。
我正在尝试从网络命名空间内捕获流量,并以非特权用户身份在主机上使用 Wireshark 查看。为此,我tcpdump
在目标网络命名空间内运行,并将捕获的数据写入/tmp/fifo
主机可访问的命名管道。
当我尝试通过运行在主机上的 Wireshark 中查看此流量时wireshark -k -i /tmp/fifo
,收到错误消息:
Couldn't run dumpcap in child process: Permission denied
运行ls -l /bin/dumpcap
输出权限-rwxr-xr-- 1 root wireshark
,这解释了为什么dumpcap
不属于该组的用户无法执行wireshark
。
由于用户实际上只是从管道读取字节,因此不需要 root 权限或能力。我可以把用户添加到wireshark
组,但该dumpcap
二进制文件有一些我不太想授予的能力。或者,我可以剥离这些能力dumpcap
,使其可由所有人执行。简单测试一下,这种方法确实有效,但可能会dumpcap
以意想不到的方式崩溃,因为它本来就是用这些能力来执行的。
有没有更直接的方法来实现我的目标?
根据维基百科:
隧道协议通过使用数据包的数据部分(有效载荷)来承载实际提供服务的数据包来工作。
隧道使用分层协议模型,例如 OSI 或 TCP/IP 协议套件,但在使用有效载荷承载网络通常不提供的服务时,通常会违反分层。
承载网络通常不提供的服务是什么意思?
我正在编写一个脚本,想在文件系统上创建一个临时文件,但它不在我的文件系统中,/tmp
而是在其他地方,而且可能不是文件也不是目录(例如,可能是命名管道或符号链接)。关键在于,我必须自己创建它。现在,我想为我的临时文件使用一个唯一的文件名,这样以后调用该实用程序以及任何其他正在运行的代码时,就不会尝试使用相同的名称。
如果我只是在中创建一个临时文件或目录/tmp
,我可以使用mktemp
。但是 - 当我只想生成名称时我该怎么做?
我正在将老旧的 Debian 11 (bullseye) 服务器上的 NodeJS 和 NPM 升级到最新的 LTS 版本。我清除了发行版中原有的nodejs和npm软件包及依赖项,并使用nodesource成功安装了 NodeJS v22.15.0 和 NPM v10.9.2 。
我现在正试图删除nodejs-legacy包 — — 我假设 — — 可能不再需要了,但是apt和apt-get(它们在这方面的行为完全相同)都抱怨:
$ sudo apt remove nodejs-legacy
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Virtual packages like 'nodejs-legacy' can't be removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
据我所知,虚拟软件包仅定义依赖项和/或安装配置文件。为什么一个软件包,即使是“虚拟”的(或者随便怎么叫)也无法卸载?apt(或apt-get)不能直接更新软件包数据库和/或删除上述文件吗?
这个特定的包甚至不属于任何依赖项:
$ sudo apt depends nodejs-legacy
<nodejs-legacy>
$ sudo apt rdepends nodejs-legacy
<nodejs-legacy>
我想我可以把它留在那里,因为它似乎与其他任何东西都不冲突(至少目前是这样)。但我宁愿让我的服务器远离那些垃圾。
删除 Debian 系统中不再需要的旧虚拟包的推荐方法是什么?
如果我们这样做:
VAR=100:200:300:400
我们可以做到:
echo ${VAR%%:*}
100
和
echo ${VAR##*:}
400
是否有任何等价物可以用来获取 200 和 300 的值?
例如,如果有超过 3 个冒号,是否有办法只获取第二个和第三个冒号之间的内容?
在带有 Bash 的 Linux 中,有一个文件numbers_in_one_line
。
此文件中只有一行,包含几个数字,所有数字均以空格分隔。
这些数字是使用 fallocate 程序创建文件的字节值。
数字是随机的并且可以改变,在这个例子中有 4 个数字:24997117901 4848337945 541113465 446445181
有时,数字可能会超过 4。
如果数字超过 1GB,那么我想用 fallocate 创建 1GB 部分。
如果数字低于 1GB,那么我想用 fallocate 创建 100MB 部件。
例如以下 4 个数字:24997117901 4848337945 541113465 446445181
我想创建如下文件:
first number (24997117901) every file in 1GB parts.
file1.01
file1.02
file1.03
file1....
second number (4848337945) every file in 1GB parts.
file2.1
file2.2
file2.3
file2....
third number (541113465) every file in 100MB parts.
file3.1
file3.2
file3.3
file3....
fourth number (446445181) every file in 100MB parts.
file4.1
file4.2
file4.3
file4....
如何区分 MB 或 GB 范围以及有多少部分,以及如何通过此命名方案为 fallocate 创建文件?
我不想先创建全尺寸的文件,然后再对它们进行拆分,因为split
拆分会带来太多的读/写访问权限。
:编辑
由 exakt 1GB,对我来说,将其分成 1 部分或拆分并不重要,您有什么建议?
我知道 bash 非常努力地保持新版本与旧版本兼容。
然而他们有时会引入(虽然很小,但仍然)重大的变化:
例如,当我们不再拥有: { foo }
#现在挂起
但必须有: #即在结束前{ foo ;}
有一个或换行符;
}
(不确定哪个版本引入了这一点,那是 20 多年前的事了 ^^)
我的问题是:如何找出在整个 bash 更新历史中发生了哪些其他“重大”变化?
对于行存储表的示例...
CREATE TABLE T(Id INT PRIMARY KEY, C1 INT NULL, C2 INT NULL);
有多种不同的方法可以从 SQL Server 中的元数据中检索表行数 - 例如以下方法
SELECT SUM(rows)
FROM sys.partitions
WHERE object_id = object_id('dbo.T') AND index_id <= 1;
SELECT SUM(row_count)
FROM sys.dm_db_partition_stats
WHERE object_id = object_id('dbo.T') AND index_id <= 1;
SELECT SUM(rows)
FROM sys.sysindexes
WHERE id = object_id('dbo.T') AND indid <= 1;
SELECT OBJECTPROPERTYEX(object_id('dbo.T'), 'Cardinality')
执行计划显然显示了正在使用的各种不同对象 - 例如下面的。
- sysrowsets OUTER APPLY OpenRowset(TABLE ALUCOUNT
- sysidxstats 交叉应用 OpenRowSet(表分区计数
- sysidxstats i 交叉应用 OpenRowSet(TABLE INDEXPROP
这是怎么回事?SQL Server 真的在多个地方维护这些元数据吗?如果是这样,哪种方法最可靠?
如果我在 postgresql.conf 中设置random_page_cost = 1.1
,它不会被设置,重启后也不会,之后也不会select pg_reload_conf();
。
但是,如果我在创建新集群之前将它放入配置文件中,它就会被设置。
如果我通过更新它ALTER SYSTEM SET random_page_cost = 1.1; select pg_reload_conf();
,它设置正确。
有人可以指导我如何找出原因吗?
(我已经开始-d 5
,希望在启动日志中找到一些有趣的东西,为什么该值被忽略,但我什么也没找到。
提前致谢。
问候,
斯蒂芬
按照SQL Server DAG 的手动故障转移中的步骤操作
要验证两个可用性组是否已准备好进行故障转移,请使用以下在 SQLCMD 模式下运行的 T-SQL 查询:
:CONNECT TDPRD071
SELECT ag.name, drs.database_id, db_name(drs.database_id) as database_name,
drs.group_id, drs.replica_id, drs.last_hardened_lsn
FROM sys.dm_hadr_database_replica_states drs
INNER JOIN sys.availability_groups ag ON drs.group_id = ag.group_id;
:CONNECT TDDR071
SELECT ag.name, drs.database_id, db_name(drs.database_id) as database_name,
drs.group_id, drs.replica_id, drs.last_hardened_lsn
FROM sys.dm_hadr_database_replica_states drs
INNER JOIN sys.availability_groups ag ON drs.group_id = ag.group_id;
如文章中所示,从全局主节点运行上述查询的结果屏幕截图显示了与 DAG 中每个 AG 的连接。
但是,当我在 DAG 的全局主节点上运行查询时,得到的结果仅来自与转发器的连接。因此,显示的两组结果仅来自与 AG02 的连接。
但是,如果我单独运行这两个查询(均来自全局主数据库),它们将根据情况正确连接到 AG01 或 AG02。
请问您有什么建议可以解释我为什么会出现这种行为吗?
谢谢。
我们目前有一台运行在 Oracle Linux 上的 MySQL 8 服务器。它运行在德克萨斯州一个托管数据中心的虚拟机上。
大约 95% 的时间花在 SELECT 操作上,大约 5% 的时间花在 INSERT 和 UPDATE 上。
我们正在努力在单独的位置(MO)添加另一个 mysql 服务器,主要是为了实现冗余和灾难恢复目的。
我的想法是,在两个位置之间建立一个隧道,并使用主位置作为主服务器来设置 MySQL 复制。这样,如果发生灾难,我可以切换到从服务器。但有一个缺点,那就是除非发生意外,否则这台专用的从服务器就一直闲置在那里,可能没有任何好处。
我正在考虑如何利用它,也许更新我的应用程序以使用从属服务器来处理一些繁重的查询/报告。
我原本以为这是一个很棒的计划,直到我开始阅读有关 MySQL 集群的文章。我们实在没有办法搭建集群所需的第三台专用 MySQL 服务器。
我的问题是:
假设您在 2 个位置有 2 个 mysql 节点,您将如何最好地利用它们?
我们的应用服务器所有东西都在 Docker 容器中运行。为了构建 MySQL 集群而不是复制,在应用服务器中添加一个 MySQL 实例(在 Docker 容器中)会不会是个疯狂的想法?
如果集群确实可行(通过应用服务器上的 MySQL 实例),我的理解是写入速度可能会变慢,因为写入操作要等到集群中所有节点都写入完毕才能完成?这可能意味着,如果集群节点分布在多个位置,写入速度会显著降低,因为两个站点之间会存在一些延迟?
任何建议都将受到赞赏。
我可能需要更改 Postgresql 配置中 lc_messages、lc_monetary、lc_numeric 和 lc_time 的区域设置。但是,在执行此操作之前,我需要了解它们具体会影响哪些内容。Postgresql 文档列出了受影响的内容,但仍然留下了很多问题。例如,文档中说upper
和lower
函数会受到影响。这是所有设置都受影响吗?还是只有部分设置受影响?文档中还说 to_char() 会受到影响。具体是如何影响的?
我想提前知道此更改是否需要更改应用程序代码,那么是否有好的资源可以帮助我生成要测试的功能/场景列表?